Newbie: Design Pattern

  • Thread starter Thread starter Mustafa Ahmad Malik
  • Start date Start date
M

Mustafa Ahmad Malik

Hi,
I am a newbie learning design patter techniques. A task is assigned to me to
implement a Communication class in C#, which will be a dll, using the most
suitable Design Pattern. The communication dll will contain implementation
of MSMQs, Pipes, Sockets etc. The purpose of it is to allow users to select
one of the communication methods present in dll and then use it for
sending/receiving data.

After studying a few pattern I came to conclusion that Factory Design
Pattern is most suitable. What you people experienced in DP, suggest?

Thanks,
Mustafa Ahmad.
 
Mustafa said:
Hi,
I am a newbie learning design patter techniques. A task is assigned to me to
implement a Communication class in C#, which will be a dll, using the most
suitable Design Pattern. The communication dll will contain implementation
of MSMQs, Pipes, Sockets etc. The purpose of it is to allow users to select
one of the communication methods present in dll and then use it for
sending/receiving data.

After studying a few pattern I came to conclusion that Factory Design
Pattern is most suitable. What you people experienced in DP, suggest?

Patterns shouldn't be forced on you as: "use a pattern to implement it".
Patterns are defined solutions to common problems. So first you have to
clearly define your problem: what do you want to do? Then, you have to find a
solution to your problem. This is best done by first cooking up a solution
yourself. This forces you to investigate what kind of issues are involved in
your problem, how code can probably be structured etc. . THEN you pick a pile
of patterns and see if there is a pattern (or set of patterns) which solves
your problem as well. It can be that there isn't a pattern which solves your
problem. (this is common). If that's the case, use your own solution.

In short: anyone who forces you to implement a pattern, no matter what,
doesn't know anything about patterns and shouldn't be leading a team.

Frans.
 
You should definately check out the book "Design Patterns" by Gamma, Helm,
Johnson and Vlissides from Addison Wesley. It is a description of a lot of
patterns and what they should be used for. It contains examples implemented
in C++.

../ask
 
You should definately check out the book "Design Patterns" by Gamma, Helm,
Johnson and Vlissides from Addison Wesley. It is a description of a lot of
patterns and what they should be used for. It contains examples implemented
in C++.

../ask
 
Frans Bouma said:
Patterns shouldn't be forced on you as: "use a pattern to implement it".

No one has forced. Its a simple excercise to learn and think which pattern
suits, if any, which problem. The solution that i thought of is to give user
an abstraction and to allow the user to enumerate which communication
methods are available and then pass some value to get instance of that
method. For example, commdll.CreateInstance( "MSMQ" ). This way if next time
a new communication method is implemented in dll then the user would be able
to use it without disturbing others. Considering this I though of a Factory
Pattern.
 
ask said:
You should definately check out the book "Design Patterns" by Gamma, Helm,
Johnson and Vlissides from Addison Wesley. It is a description of a lot of
patterns and what they should be used for. It contains examples implemented
in C++.

Is there equivalent book for C#?

Thanx
 
Back
Top