“Pressing down the pillow” refers to one’s efforts not to let the head of one’s opponent rise. In battles based on martial strategy, it is taboo to let your opponent take the initiative, thus putting yourself on the defensive. You must try at all costs to lead your opponent by taking complete control of him. During combat, your opponent intends to dominate you as much as you want to dominate him, so it is vital that you pick up on your opponent’s intentions and tactics so as to control him … According to the principle of martial strategy, you must be able to control your opponents at all times. Study this point well. THE BOOK OF FIVE RINGS, MIYAMOTO MUSASHI, 1584-1645
Design Patterns
- Describe simple, elegant solutions to specific problems
- Systematically names explains and evaluates – recurring design
- Helps to get a design “Right Faster” – proven techniques
- Insights – flexible, modular, reusable and understandable
- Solutions developed over time
- Object-oriented architecture – full of catalogue patterns
- Architecture – simpler, smaller and more understandable
- Types – creational, behavioral and structural
- References – sources of information
- Template method, abstract factory, factory method, observer, strategy
- Designing First Principles – General to address future problems/requirements – Specific to the problem
- 1. Pertient objects – clear, decisive, relevance
- 2. Factor to classes – at right detail granularity
- 3. Definition – Class interface / Inheritance hierarchies
- 4. Establish Key relationships – Reuse past working solutions – experts
Each design describes a problem, which occurs over and over in the environment, then describe a core solution, in a way that you can reuse solution, without doing it same way twice
In short, I think like Frederick [the Great], one should always be the first to attack. NAPOLEON BONAPARTE, 1769-1821
Pattern Essential Elements
- Name: Is a handle to describe
- Design problem – adds design at a higher level of abstraction
- Consequences – vocabulary, ease of thinking and communication
- Solution -Describe how the arrangement of classes/objects solve
- Problem – Describe when to apply the pattern
- Explain problem context – inflexible classes
- Lists of conditions to be met
- Specific Design problem – how to represent algorithms
- Solution – Describe elements that make
- Design and relationships – Provide an abstract description of the design problem
- Responsibilities and collaborations
- Consequences – results or tradeoff of applying
- Often space/time – a template that can be applied in many different situations
- Flexibility, extensibility and portability
One who excels at warfare compels men and is not compelled by others. SUN-TZU (4 CENTURY B.C.)