BY PANKAJ KAMTHAN
1. INTRODUCTION
This document tells a ‘story’ of the evolution of a program caused by the unforeseen changes in the requirements [Martin, 2002; Martin, Martin, 2006].
Let I be the set of input devices, O be the set of output devices, and let P be the program.
Then the story is about the impact on the design of P due to variations in | I | and | O |, where | · | denotes the cardinality.
The moral of the story is that, unless there is adequate preparation for change in advance, the quality of the design of a program can rapidly deteriorate to the point that the loss can become irreversible.
2. NOTATIONS AND CONVENTIONS
There are certain statements in the rest of the document that are associated with specific graphical notations.
The presence of the ‘dangerous bend’ symbol1 illustrated below should be interpreted as a warning.
The warnings reflect a violation of the underlying philosophy of object-oriented design
(OOD) aiming for ‘high-quality’, in general, and, by reference, a violation of one or more object-oriented design principles (OODP), in particular.
1
The symbol is an electronic rendering of that shown in [Knuth, 1984].
1
The presence of the smiley icon [Sanderson, 1997] illustrated below should be interpreted as a (negative) impact on (solution) quality.
3. “SOLID” OBJECT-ORIENTED DESIGN AND PROGRAMMING
The more science becomes divided into specialized disciplines, the more important it becomes to find unifying principles.
― Hermann Haken
SOLID is a mnemonic acronym for five basic principles of object-oriented design and programming [Martin, Martin, 2006], summarized in Table 1.
Acronym
SRP
OCP
LSP
ISP
DIP
OOD Principle
The Single
Responsibility
Principle
The Open-Closed
Principle
The Liskov
Substitution
Principle
The Interface
Segregation
Principle
The Dependency
Inversion Principle
Statement
A class should have only one reason to
References: [Beck, 2000] Extreme Programming Explained: Embrace Change. By K. Beck. AddisonWesley. 2000. [Boswell, Foucher, 2012] The Art of Readable Code. By D. Boswell, T. Foucher. O’Reilly Media. 2012. [Gamma, Helm, Johnson, Vlissides, 1995] Design Patterns: Elements of Reusable Object-Oriented Software [Ghezzi, Jazayeri, Mandrioli, 2003] Fundamentals of Software Engineering. By C. Ghezzi, M. Jazayeri, D. Mandrioli. Second Edition. Prentice-Hall. 2003. [Knuth, 1984] The TEXbook. By D. E. Knuth. Addison-Wesley. 1984. [Martin, 2002] Agile Software Development: Principles, Patterns, and Practices. By R. C. Martin. Prentice-Hall. 2002. [Martin, Martin, 2006] Agile Principles, Patterns, and Practices in C#. By R. C. Martin, M [Sanderson, 1997] Smileys. By D. W. Sanderson. O’Reilly Media. 1997. [Strachey, 2000] Fundamental Concepts in Programming Languages. By C. Strachey. Higher-Order and Symbolic Computation. Volume 13. 2000. Pages 11-49.