views:

76

answers:

3

Hello,

I am creating a reusable component in C#.net. For that i have started a Control Library project and added a Control.

Class MyControl : Control{}

My user control just displays some images which will be used in many Windows Applications.

Can you please tell me which design pattern i am using here. I am unable to decide which pattern they belongs.

Thanks

Added:- What suppose for any problem my solution is to create a user control. Then i am following to which design pattern now????

See all the design pattern and lets deside. http://en.wikipedia.org/wiki/Software_design_pattern

+2  A: 

It does not sound to me like you are using any particular design pattern. At best, you are writing reusable code, but I don't think that is a design pattern in it's own right.

klausbyskov
+2  A: 

I'm not sure that we could say that you are following any design pattern, it's just basic Inheritance from what you describe which is a OOP principle not a design pattern. The process should be to identify which design patterns solve your problem and then implement them. Trying to do it in reverse is unlikely to reveal a pattern or if it does then I'd suspect the implementation would only very loosely follow said pattern.

Lazarus
What suppose for any problem my solution is to create a user control.Then i am following to which design pattern????
prashant
Creating a user control isn't a design pattern, it is a simple as that. Design patterns are normally about more abstract concepts such a the repository, the singleton, the factory which are applying best practice to particular problem spaces. There isn't a design pattern for everything you do as a developer, sorry. I also hate to say it but if you didn't set out to implement a specific pattern then you haven't implemented it, you've just been lucky or brilliant.
Lazarus
@Lazarus, I could not agree more.
klausbyskov
@Lazarus, Great explanation....+1
Raja
+2  A: 
  • inheritance & abstraction - OOP's features to have a re-usable component

Don't think there is any design pattern involved here...

HTH

Sunny
Where do you see @prashant applying abstraction here?
Lazarus
Sunny
Firstly I'd like to thank you for making me think, I had to go back and review my understanding of abstraction here so that's a good thing indeed! I'd see the class 'Control' as the abstract class here and MyControl as the concrete implementation, hence my question. That said, you have an interesting point regarding the content of 'MyControl', i.e. the images. However that is very much a 'has a' rather than an 'is a' relationship and as such is composition not abstraction although the OP is indirectly taking advantage of abstraction when they add their MyControl to the Controls collection.
Lazarus
Sunny