none
Design Patterns RRS feed

  • Question

  • hi all,

       I am new to architecture and design patterns. I am developing one application in Layered architecture. I mean SOA architecture(4 layered). Now i need some guidance from you like what are the design patterns need to apply for better approach. I also read that SOA itself is a design pattern. Can any one clear me about this patterns as a beginning. Also read that need to apply singleton pattern. So i confused that multiple patterns are used in single application or what? Sorry for very beginning question, Actually Architecture and Design pattern is same or different?

    Saturday, July 28, 2012 3:35 AM

All replies

  • Design patterns are used in certain scenarios where you have some preferences. For example, you want the flexibility in object creation,  patterns like abstract factory will help you. You want to compose an object during runtime, you got builder pattern for it.

    If you want one object (which can be application configuration) during life of the program, you got singleton pattern. If you want to speed up the object creation, you got prototype pattern. If you want to change the behavior of object during runtime, you got strategy pattern. If you want event based communication, you got observer pattern. 

    You can have multiple patterns used in single application based on needs in certain area of the application. You can use factory on top of data access layer, and singleton object to hold custom configurations.

    SOA is on higher level than these patterns. Its an architecture basically more than a pattern.

    Book titled "Head First Design pattern" will give you more insight with the scenarios.

    http://shop.oreilly.com/product/9780596007126.do

    Monday, July 30, 2012 5:13 AM
  • Hi Akhil,

                Answer to your last question , Archirtecture and Deisgn pattern are different.

    Design patterns are the solution for the common problem . few examples available in  http://www.codeproject.com/Articles/33530/Design-Pattern-Examples-in-C

    It is a very common trend of new architects tends to use lot of design patterns in architecture. I personally suggests to  use design patters only if it is necessary or we are sure that we will get all the advantage if we use a pattern why because patterns all ways gives a slight overhead in coding.

    But design patterns is a great help for some right situations like object initiation , state maintanance etc etc....While designing your system identify the places were design patters can be used and evaluate it in early stage itself

    SOA is not only a pattern it is bit more higher than a design pattern, probably an architecture.

    Regards,

    Pramod

    Monday, July 30, 2012 9:56 AM
  • Thanks friends.

      So Singleton pattern is used if i have a utility class or something like that?

    Wednesday, August 1, 2012 3:04 PM
  • Singleton pattern is used when you want to have one object that lives through out the life of the program. This object can be a service provider or it can be holding configurations. Object representing program configuration will be shared by many other objects. If the singleton class is a service provider, it can do some job for you taking in request and giving you the response. 

    more information can be found in the below url

    http://www.c-sharpcorner.com/uploadfile/faraz.rasheed/singletonpattern12052005063955am/singletonpattern.aspx

    Thursday, August 2, 2012 4:39 AM
  • SOA is an architectural style (A - architecture), that is it explains the ideas about something should be done, but doesn't prescribe the implementation. Microsoft has a stab at defining this; http://msdn.microsoft.com/en-us/library/ee658117.aspx

    A Design Pattern is way of giving a name to way of implementing something that is typically much closer to actual algorithms. Once we have a name we can discuss it and everyone knows what we mean - that's the theory (How many people know exactly what the Builder pattern is without looking it up?). There is plenty on-line about design patterns; http://en.wikipedia.org/wiki/Design_Patterns

    Personally I like SOA and if you want to get a better idea then it's worth investing in;

    http://www.udidahan.com/training/#Advanced_Distributed_System_Design


    http://pauliom.wordpress.com

    Thursday, August 2, 2012 8:35 AM