Needs of Design Patterns in an Application?

When we talk about design patterns, its seems to be rocket science for some developers and some developer finding it easy to go. Here I will try to make this rocket science design patterns to be a easy to go. Lets answer below questions before going to be a pro in design pattern in java and will try to answer one by one here.
  1. What is Design Patterns?
  2. What is an application?
  3. Why we need Design patterns in application?
  4. How many types of design patterns you now?
  5. How to judge the best scenario for any design pattern to be selected.
  6. How to best implement any pattern?
If you are not sure about the answers of above asked question then please wait lets describe it one by one here.
Brief about Design Pattern,
– Before jumping into answers, lets know something about the design patterns, Design patterns is all about the documentation and implementation of a specific problem which have the common or you can say a well known solution, Concept for Design Pattern was initially started by four guys Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, who was collectively famous as GOF which means Gang of Four, who documented the problem and design pattern concept in the form  of book called Design Patterns: Elements of Reusable Object-Oriented Software. In which they have classified the book in below major criteria so as to understand the concept of design pattern.
  • Pattern Name and Classification: A descriptive and unique name that helps in identifying and referring to the pattern.
  • Intent: A description of the goal behind the pattern and the reason for using it.
  • Also Known As: Other names for the pattern.
  • Motivation (Forces): A scenario consisting of a problem and a context in which this pattern can be used.
  • Applicability: Situations in which this pattern is usable; the context for the pattern.
  • Structure: A graphical representation of the pattern. Class diagrams and Interaction diagrams may be used for this purpose.
  • Participants: A listing of the classes and objects used in the pattern and their roles in the design.
  • Collaboration: A description of how classes and objects used in the pattern interact with each other.
  • Consequences: A description of the results, side effects, and trade offs caused by using the pattern.
  • Implementation: A description of an implementation of the pattern; the solution part of the pattern.
  • Sample Code: An illustration of how the pattern can be used in a programming language.
  • Known Uses: Examples of real usages of the pattern.
  • Related Patterns: Other patterns that have some relationship with the pattern; discussion of the differences between the pattern and similar patterns.
Now lets back to our discussion, Now how to define design pattern now.
What is Design Patterns,
– A Design pattern is a pre-defined solution to a recurring issue, issue may be of java, .net, PHP or any technology/framework, here implementation may vary with technologies/languages or framework but concept to have the problem solved  will  remain same while implementing any design patterns.
What is an Application?
– You were be surprised why we have asked this question here why we need to know the application to design pattern and how it can be related to design pattern, Yes its important to know your application before implementing any design pattern in it.
Ok, Let me ask you one question if you have doubt, If your car has break down , its Tyre pass away, now when you reach to Tyre shop what will you do, what will you ask for. Hmmm…, You have to ask for a specific type which will fit in your specific car, hope you will not ask for any Tyre irrespective to of car specification. yes this is what the difference is. You have to be very precise before implementing the design pattern.
Anyways Design pattern is dependent on many factor of application and not all design pattern can be implemented in a single Application.
Why we need Design patterns in an application,
While developer working on an application, he suddenly face an issue for coding on some functionality/requirement,now he work hard to resolved it  and now after putting an decent amount lets say X hrs he able to solve the problem.
Till now, there is no issue and if it will be only one time issue, Now what should happen when this developer who work hard and put X hrs to solve the issue resign from company or developer from other company have the same problem and put same effort again, So here is the concern which a design pattern try to resolve here.
Yes, you got it right, Now we will ask developer to document the problem and its solution too. Now you will wondering, whats the big deal, it is used to happen in every company.
Yes, Its a big deal, Check out the GoF(Group of Four) for it, its a matter to have all those problem and its solution compile in a document and make some benchmark on acceptance by the user(developer/Architect who gonna use them and feel it beneficiary) this is what GoF try to achieve by their book Design Patterns. 
How many types of design patterns you now,
Generally, Design patterns are divided into three category, as follows
  1. Creational Design Patterns, Creational Design pattern is basically focus on creation of object for class.
  2. Behavioral Design Patterns, it help you compose groups of objects into larger structures, such as complex user interfaces or accounting data.
  3. Structural Design Patterns, This helps in communication between objects in system or application and control the flow between objects in a complex application.
Please share if you like.

We frequently update my articles to best of my knowledge, please touch base with us to get maximum.

If you like reading Please share with others or provide feedback to make it better.