Software Architecture in Practice

Read this section to learn about the main elements, patterns, quality attributes, and principles of software architecture, including encapsulation, polymorphism, and dependencies. Pay attention to design patterns and their importance in software design.

4. Principles & Patterns

Design Patterns 

1. Creational patterns - patterns that determine how objects are created 

2. Structural patterns - patterns that dene relationships between objects 

3. Behavioral patterns - patterns that dene the communication between objects

 

Creational Design Patterns 
  • Abstract factory - request an object from a factory object 
  • Factory method - choosing an object implementation, creating the object and returning it 
  • Builder - builds complex objects that may have different representations 
  • Dependency injection - request an object from an injector 
  • Lazy initialization - create an object only when its needed 
  • Object pool - avoid expensive object creation and release of resources by recycling objects that are not in use 
  • Prototype - cloning an object to create a new instance 
  • Singleton - restrict instantiation from creating more than one object

 

Structural Design Patterns 
  • Adapter - adapts one interface to another 
  • Bridge - separating an interface from its implementation 
  • Composite - structure of different objects 
  • Decorator - adds additional functionality to its interface 
  • Facade - masks complex structural code eg. using many objects and executes different methods 
  • Flyweight - caching and storing objects with the same "value" 
  • Private class data - restrict accessor and mutator methods to access 
  • Proxy - connects two other components and may add more functionality

 

Behavioral Design Patterns 
  • Chain of responsibility - passes a request through a chain of objects 
  • Command - encapsulate information to trigger an event or action 
  • Interpreter - evaluation of grammatical representation 
  • Iterator - a way to access each element of a collection 
  • Mediator - coordinates between different objects Memento - restores an object to its previous state 
  • Null object - acts as the default value of a class 
  • Observer - a way of notifying other objects of an object's state change 
  • State - when an internal state changes, the object's behavior changes 
  • Strategy - determines the algorithm that should be used for the implementation
  • Template method - skeleton of an algorithm as an abstract class that allow subclasses to determine the behavior
  • Visitor - separates the algorithm from the object it operates