Overview of Design
1 Overview
- Remember this cliche What : How :: Spec : Design
- Designing (verb): Discovering a "how" procedure for the "what does it do" given in the spec.
- A spec is an IO relation. More ../Specs
- Waterfall implies that, when working on a spec, we do not yet have a design or implementation.
- For complex products, we have hierarchies of abstractions, designs, and design spaces.
- The section headings below are clickable links.
2 Examples of Spec/ Design
- Several example specs and design are shown.
- Ex: Knuth's Common Words Problem: Requ, Specs, Design and Impl. Published. [There will be lectures on this.]
- Ex: Req, Spec, Design and Proof of a Pretty Printer for PLs Published. [There will be lectures on this.]
3 Correct by Design
- Correct By Design; i.e., "Correct By Intention/Effort"
- How do we judge if a design is "correct"?
- Precise def of "A design D satifies/meets a spec S"
- A spec S is consistent with a requirements document R. How do we check this? Judge/jury system.
5 Design Documentation
- Recall that: A spec is a relationship between IO, expressed using discrete math, logic, and grammars. We prefer it to be declarative. But, occasionally we do use an older version of a program to be a spec for a new version to be built, with additional spec details added.
- A design is a how-to expressed in a high-level notation, far higher than typical programming languages such as C++ and Java.
5.2 Design Rationale and Knowledge
- "A design rationale is the explicit listing of decisions made during a design process, and the reasons why those decisions were made."
- Design knowledge is the collection of techniques and past designs. Usually narrowed down by the topic. E.g., design knowledge of compilers, clients-servers.
5.3 Structure of the Document
5.4 Req Doc vs Spec Doc vs Design Doc vs Impl Doc
- See our [Projects] page.
5.5 Literate Programming ./literate.html
6 Object Oriented Design
The above sections did not assume OOP/OOD. This does.
6.1 The Liskov Substitution Principle
- Liskov Substitution Principle (LSP) is the L in SOLID Principles of OOD. It clarifies the meaning of inheritance beyond mere syntax. The principle applies to best practices in all OOP languages; certainly to: C++, Java, Scala, and Python. The clarification is crystal clear in the presence of pre- post conditions and class invariant.
6.2 SOLID Principles
- Principles of Class Design (aka SOLID)
- (SRP) The Single Responsibility Principle
- (OCP) The Open Closed Principle: Classes and methods should be open for extension (of functionality) and closed for modification.
- (LSP) The Liskov Substitution Principle: Subtypes must be substitutable for super type. A sub class must enhance functionality, but not reduce.
- (ISP) The Interface Segregation Principle
- (DIP) The Dependency Inversion Principle. [In our course, I prefer the DbC.]
6.3 OODesign Patterns
- A design pattern is a solution template for problems of a certain pattern.
- A pattern codifies expert knowledge.
6.4 Design Smells
- "Design smells indicate violation of fundamental design principles and negatively impact design quality"
- Code smells has extensive literature. Design smells not so much.
6.5 Refactoring
- Refactoring is the modification of software source code to improve software qualities while preserving functionality.
- Enhancement is not refactoring.
- Refactoring is part of maintenance
6.6 AntiPatterns
- "An anti-pattern is a common response to a recurring problem that is usually ineffective and risks being highly counterproductive."