Design patterns are meant to be a form of best practices as to how to develop object oriented code and found by trail and error in many cases. Additionally design patterns are supposed to provide a common platform for developers, so they can talk to one another based upon what they expect to occur.
By using a tested pattern, we should be able to develop our applications faster and with fewer problems.
An important thing to note, is that design patterns are language agnostic. That is, you will find these patterns being used in multiple languages, not just Java. This is the same idea of UML Classes can be used to define classes in many languages, not just Java.
However, you cannot think of a design pattern as a set of completed code, rather it should be viewed as a template – or a more generalized solution.
Patterns typically fall into one of three categories.
- Creational – ways to create objects while hiding the creation logic rather than instantiating with the
new
operator – which ironically is how we often show new students how to create programs.- Factory
- Singleton
- Object Pool
- Prototype
- Structural – Concept of inheritance is used to compose interfaces and define ways to compose objects to obtain new functionalities.
- Adapter
- Bridge
- Composite
- Proxy
- Behavioral – are specifically concerned with communication between objects.
- Command
- Interpreter
- Null Object
- State
While design patterns have been used in many applications, that is not to say they are not always accepted in general. Some feel they have not been formally vetted, only in an AdHoc manner. As such they may not provide the best solution, but rather a “good enough” solution which may not actually scale well, or be as efficient as possible.
What is a Design Pattern was originally found on Access 2 Learn
2 Comments
Comments are closed.