13 Design Patterns
Object Oriented design must be
- specific to the problem, and
- general to adress future problems and requirements
Design Patterns¶
Descriptions of communicating objects and classes, that are customized to solve a general design problem, in a particular context.
allows
- re-usability of design
- faster production of projects
- more accessible
- easier documentation and maintenance
Parts¶
- Pattern Name
- Problem
- Solution
- Context
- Class Diagram
Types of Patterns¶
- Creational Patterns deal with object creation
- Singleton Single object of a class is created, and all other objects can access it globally
- Structural Patterns deal with relationship between entities
- Composite when you put components inside containers eg: JPanel
- Decorator something that surrounds component eg: scroll bars
- Adapter Pattern a middle interface ‘adapts’ main interface based on the requirement
- Proxy Pattern a class acts a proxy to access another class, to keep that hidden
- Behavioural Patterns communication between objects
- Iterator access the elements of an aggregate object sequentially without exposing its underlying implementation
- Observer eg: ActionListener