- Software’s Primary Technical Imperative is managing complexity. This is greatly aided by a design focus on simplicity.
- Simplicity is achieved in two general ways: minimizing the amount of essential complexity that anyone’s brain has to deal with at any one time, and keeping accidental complexity from proliferating needlessly.
- Design is heuristic. Dogmatic adherence to any single methodology hurts cre- ativity and hurts your programs.
- Foundation of OOP and structured design
- Thinking in objects vs thinking in information hiding
- Hiding abstracts complexity and delays lock in; thinking in OOP locks you into smaller set of decisions
- e.g. Should something be declared as a new class
- Information Hiding is consistent with OOP
- Hiding abstracts complexity and delays lock in; thinking in OOP locks you into smaller set of decisions
Accommodating change is a big challenge of software design. Isolate instabilities and changes.
- Business rules
- Hardware dependencies
- Input and output
- Non standard language features
- Difficult design and prototypes
- Status variables
- Don't use booleans, try enumerated types
- Use access routines
- Data size constraints
A "loose coupling" between two classes is characterised by small, direct, visible and flexible relations.
- Size
- Fewer args is better
- Fewer public methods is better
- Visibility
- Flexibility
- How easily one module uses another
- The easier the less coupled
- Simple-data-parameter coupling
- Data passed between are primitive data types, all passed though parameter lists
- Simple-object coupling
- Instantiates the object
- Object-parameter coupling
- Obj1 requires Obj2 to pass to Obj3.
- Semantic coupling
- Dangerous because it can break code in ways that are not detectable by compiler
- One module makes use not of some syntactic element of another module but of some semantic knowledge of another module’s inner workings.
- Reduces complexity through ready-made abstractions
- Institutionalizing details of common solutions
- Conceptually similar to using a library
- Patterns streamline communication by moving the design dialog to a higher level
- Top down
- Defer construction details
- Divide and conquer
- bottom up
- Encourages reuse of existing modules
- Compact well factored design
- Experimental prototyping
- Important to treat code as throwaway
- Collborative design with co workers
- Informal, bounce ideas with one another