Source |
They were not developed intentionally, they were instead created by trial and error and the prevalent ones are the ones that, by natural selection, were proven to be the best ones.
The Gang of Four, are the ones that wrote a book and set the SDP principles down, the book is called "Design Patterns - Elements of Reusable Object-Oriented Software". The two main principles are:
- Program to an interface, not an implementation: Basically programming the classes in order for them to be implementable by other software, resuable and act as pieces of a bigger puzzle.
- Favor composition over inheritance: Classes should implement other classes to complete their functionality, rather than inheriting from them.
- Creational: Create objects on the go as they are being used.
- Structural: The composition of objects is of most importance, mix and match to obtain new functionality.
- Behavioral: Communication between objects is prioritized.
- J2EE: Presentation layer.