4.7 Design Patterns
4.7.1 Introduction and Basic Concepts
Patterns have been with us for quite some time now, starting essentially with the Model-View-Controller (MVC) one of Smalltalk76. However, it wasn't until OO languages (in particular, C++ and Java) were more widely used that the topic became a "hot" one. The reason for this was all to do with just one factor: code reusability. OO techniques, in particular, class structuring aspects (association, inheritance, aggregation, and polymorphism), gave designers powerful ways to describe and implement patterns. Before looking into this in detail, however, we first need to answer three important questions:
- What are the patterns?
- Why do we use them?
- How do we implement them?
Let's start with the first question: what exactly is a pattern? It turns out that there isn't a single definition; mainstream dictionaries give many alternatives. However, the key factor is that these depend very...