During our sessions and discussions in KolkataNET I have noticed that many of our members are aware of the term "patterns" in context of software development .They know about patterns like Singleton,MVC etc. but they are not very much clear on the basic purpose of patterns,difference between architectural and design patterns,what are the available and mostly referred to pattern catalogs etc.One possible reason might be that they have used some of the techniques and patterns in their development projects but did not studied much on the subject.Many of them have the interest but not enough time to get into the details.Some might have not got the right sources of information.
I have been an enthusiast of OOAD and Patterns since 2003.I was not alone, we had a group.We used to buy different books on this subject, collect articles,blogs and discussed on how we can use these to engineer better software.We all were convinced that this a great tool to develop a common vocabulary for software architecture and design and have standard solutions to commonly encountered problems.I still feel the same way, it's extremely important to understand patterns properly to design and construct better software.So in a series of posts I am planning to talk about patterns starting from the very basics.As I am no expert on the subject I will just share my learning and understanding.In case I am wrong somewhere my earnest request to the readers would be to leave a comment, so that I can correct myself.
To start with let us think how we normally try to solve problems we encounter in our daily lives.We think of a similar problem which we have already solved or we know about the solution.We think in terms of problem solution pairs and try to relate it back to our current problem.So we try to find out a common pattern among the problems and to apply a similar solution.Now think of a person who has faced many problems while working in a particular field.He has a ready list of problem solution pairs in his mind.He can apply this very quickly to solve a similar problem and hence termed as an Expert.
Architect Christopher Alexander first mentioned about the pattern in his book The Timeless Ways of Building in context Civil Engineering and Architecture.This book seems to have more influence in the field of Computer Science rather than Architecture.His ideas had a profound impact on the patterns and pattern languages movement in the software community.Alexander has defined patterns in terms of it's three crucial components Context,Problem and Solution.
- Context - The situation in which a recurring design problem arises
- Problem - A set of forces repeatedly arising in the context
- Solution - A configuration that balances those forces
So in short, we can say a pattern addresses a recurring design problem that arises in specific situations.Here are trying to get these problem solution pairs out of the experts head and trying to build a catalog to which any practitioner can refer to and solve his problem.
In software we can classify patterns into the following three types:
- Architectural Patterns - Architectural Patterns provide a set of predefined subsystems,specifies their responsibilities and defines and rules and guidelines to organizing the relationship between them.They specify the system wide structural properties.One good example is the popular Model View Controller (MVC) pattern.We will discuss MVC in details in one of the upcoming posts.
- Design Patterns - Design patterns provides specifications to refine the individual subsystems and the relationships between them.These are smaller in scale than the architectural patterns but independent of any particular programming language and implementation.Observer can be a good example of design pattern
- Idioms - These are patterns specific to a particular programming language for example the Dispose pattern we use in C#, a standard way of releasing underlying unmanaged resources but very specific to C#.
In the next couple of posts we will cover following basic Architectural Patterns from the Pattern Oriented Software Architecture (POSA) catalog:
- Layers
- Pipes and Filters
- Blackboard
- Model View Controller
- Microkernel
- Reflection
Reference
Pattern-Oriented Software Architecture - A System of Patterns
