What is a pattern?
A pattern in software describes a particular recurring design problem that arises in specific design context, and presents a well proven generic scheme for its solution.
A pattern is a three-part rule, which expresses the relation between a certain context, a problem and a solution.
Context: a situation giving rise to a problem
Problem: the recurring problem arising in that context
Solution: a proven resolution of the problem
Why do we need software patterns?
Patterns help you build on the collective experience of skilled software engineers. They capture existing, well-proven experience in software development and help to promote good design practice. Every pattern deals with a specific, recurring problem in the design or implementation of a software system.
Other than this they help with a serious problem in software engineering: you hire a newcomer to a project and no matter how well they know the programming language, it takes them months to get up to speed with how things are done in your project before they can be productive.
The software industry has been trying to come up with ways to improve this. Standardization of programming languages was one way. Standard libraries (class libraries nowadays) has been another way; however, one of the most important ways has perhaps been designing patterns. So, are software patterns important? Very.
Pattern Categories
Architectural Patterns
An architectural pattern expresses a fundamental structural organization schema for software systems. It provide a set of predefined subsystems, specifies their rehabilitates, and includes rules and guidelines for organizing the relationship between them.
Design Patterns
A design pattern provides a scheme for refining the subsystems or components of a software system, or the relationships between them. It describes a commonly-recurring structure of communicating components that solves a general design problem with a particular context.
Idiom
An idiom is an low level pattern specific to a programming language. An idiom describes how to implement particular aspects of components and relationships between them using features of a given language.
Popular Architectural Patterns
- Layered (n-tiers) – https://www.oreilly.com/library/view/software-architecture-patterns/9781491971437/ch01.html
- Event driven – https://www.oreilly.com/library/view/software-architecture-patterns/9781491971437/ch02.html#idp949504
- Microservices – https://www.oreilly.com/library/view/software-architecture-patterns/9781491971437/ch04.html#idp1166176
- Space based – https://www.oreilly.com/library/view/software-architecture-patterns/9781491971437/ch05.html#idp1264816
- Client server –https://en.wikipedia.org/wiki/Client%E2%80%93server_model
- Master slave – https://subscription.packtpub.com/book/big_data_and_business_intelligence/9781783989126/1/ch01lvl1sec10/the-master-slave-architecture
- Pipes and filters –https://docs.microsoft.com/en-us/azure/architecture/patterns/pipes-and-filters
- Blackboard –https://en.wikipedia.org/wiki/Blackboard_(design_pattern)
- Broker –http://www.openloop.com/softwareEngineering/patterns/architecturePattern/arch_Broker.htm
- Model-View-Controller –https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
- Micro-kernel – https://www.oreilly.com/library/view/software-architecture-patterns/9781491971437/ch03.html#idp1081312
- CQRS –https://docs.microsoft.com/en-us/azure/architecture/patterns/cqrs
- Event Sourcing – https://martinfowler.com/eaaDev/EventSourcing.html
- Peer to peer –https://www.sciencedirect.com/topics/computer-science/peer-to-peer-architectures
- Event bus – https://medium.com/elixirlabs/event-bus-implementation-s-d2854a9fafd5
Popular Design Patterns
Creational Patters
- Singleton –https://sourcemaking.com/design_patterns/singleton
- Prototype –https://sourcemaking.com/design_patterns/prototype
- Object pool –https://sourcemaking.com/design_patterns/object_pool
- Builder –https://sourcemaking.com/design_patterns/builder
- Factory –https://sourcemaking.com/design_patterns/factory_method
- Abstract factory –https://sourcemaking.com/design_patterns/abstract_factory
Structural Patterns
- Adapter –https://sourcemaking.com/design_patterns/adapter
- Bridge –https://sourcemaking.com/design_patterns/bridge
- Composite –https://sourcemaking.com/design_patterns/composite
- Decorator –https://sourcemaking.com/design_patterns/decorator
- Facade –https://sourcemaking.com/design_patterns/facade
- Flyweight –https://sourcemaking.com/design_patterns/flyweight
- Private class data –https://sourcemaking.com/design_patterns/private_class_data
- Proxy –https://sourcemaking.com/design_patterns/proxy
Behavioral patterns
- Chain of responsibility –https://sourcemaking.com/design_patterns/chain_of_responsibility
- Command –https://sourcemaking.com/design_patterns/command
- Interpreter –https://sourcemaking.com/design_patterns/interpreter
- Iterator –https://sourcemaking.com/design_patterns/iterator
- Mediator –https://sourcemaking.com/design_patterns/mediator
- Memento –https://sourcemaking.com/design_patterns/memento
- Null object –https://sourcemaking.com/design_patterns/null_object
- Observer –https://sourcemaking.com/design_patterns/observer
- State –https://sourcemaking.com/design_patterns/state
- Strategy –https://sourcemaking.com/design_patterns/strategy
- Template method –https://sourcemaking.com/design_patterns/template_method
- Visitor –https://sourcemaking.com/design_patterns/visitor
Hope you found this article useful. In the near future I plan to write a separate article for each pattern.
Thanks for reading. 😊
Last modified: September 6, 2024