So what exactly are design patterns? Well, every day that we’re building software,we are usually presented with a lot of challenging problems, problems that we might have already solved. When presented with re-occurring problems, we are faced with a decision.Solve the problem again and again for each application where it occurs, or solve the problemonce and for all with an improved solution, a pattern, a solution that you can use over and over again in any type of application where this problem occurs. If you find your solution works well by proving it in various applications and situations, and you feel like you can safely use your solution a million times over, it might be time to make it official.
Give your solution a name. Document your solution, evangelize it. Get other developers using your solution to solve the same problem when they face it. You will have just created a design pattern. Design patterns are reusable, reliable solutions to problems that we face every day in software development. Design patterns are named, cataloged solutions. They are well-tested and reusable in many different situations. They are well-documented so other developers can learn them, and they are easy to talk about with other engineers who already know them.
They make your code better and your applications less brittle. It’s easier to add new features or modules to applications where you use them. Although some design patterns may be difficult to learn at first, they ultimately simplify your code. Their aim is to present solutions for decoupling objects or modules and reducing the overall complexity of your architecture. Not only will understanding design patterns make you write better code, they will make you a better programmer, because learning design patterns gives you techniques that you can use when faced with common programming problems and a knowledge base that is easy to discuss at, say, an interview.
As a programmer who wants to write better code and reflect on better ways of doing things,learning and using design patterns is a must.