Download presentation
Presentation is loading. Please wait.
Published byDominick Paul Modified over 9 years ago
1
Week 2 Design Examples and Designing for Change Alex Baker
2
Implementation Design An implementation design is a road map – understandable, unambiguous, consistent, helpful, … An implementation design describes a path from system design to the outcome – correct, complete, concise, verifiable, effective, … An implementation design describes what the implementers should do – elegant, partitionable, recomposable, resilient, … An implementation design is a guide towards future change – evolvable, …
3
Emphasis on Changability Change abounds… – During design – During coding – Upon delivery – After use Reuse for later projects
4
Emphasis: Changability Subtle Requires foresight and careful balancing An implementation design describes what the implementers should do – elegant, partitionable, recomposable, resilient, … An implementation design is a guide towards future change – evolvable, …
5
Changability: Basic Principles Low Coupling: Reducing interdependency – Changes don’t propagate – Reuse is facilitated High Cohesion: Grouping functionality – Easier to find things – Metaphor guides decisions Information Hiding
6
The Ideal Program … vs.
7
A Very Simple Example A sorted list class with: 1) getArray() : Array 2) getElementAt(int i) : Element
8
A Very Simple Example A List class with: 1) getArray() : Array 2) getElementAt(int i) : Element Its too slow, so we switch to a hash table 1) Everywhere you call getArray needs changing 2) Only List is changed Little things like this add up
9
UML Review: Class Diagrams Class Name Attribute : Type Operation (parameter) : Return Type Attribute : Type Operation (parameter) : Return Type
10
UML Review: Class Diagrams Association Aggregation Generalization Composition
11
A Class Diagram
12
Example 1: Theseus and the Minotaur http://www.logicmazes.com/theseus.html
13
Original Theseus Design
14
What if we want to add “Water” ?
15
Original Theseus Design What if we want to add “Water” ? ?
16
Original Theseus Design What if we want to add “Water” ? How do we fix this? ?
17
TntM: Changes Changing the board size Adding terrain types Adding more monsters Adding a second player “Intelligent elements”
18
TntM 2
19
TntM 2: Object Interfaces & Inheritance
20
TntM: Changes Changing the board size Adding terrain types Adding more monsters Adding a second player “Intelligent elements”
21
How far is too far? Changing board size? Pushable blocks? Intelligent elements? Real time gameplay? Physics challenges?
22
Bonus! StompOn( stompee ) Or StompedOn( stomper )
23
Example #2 Klax Blocks fall from above, use a paddle to catch Deposit blocks in one of 5 columns Try to make lines of 3 in a row or more http://www.123games.dk/game/puzzle/klax3d/ klax_eng.php
24
A Good Klax Design?
25
Chiron 2 Architectural Style
26
C2 Klax
27
Spelling Klax?
29
Scrabble? How did you design for change?
30
Scrabble? How did you design for change? Could you redesign / refactor for – Changes to letter values?
31
Scrabble? How did you design for change? Could you redesign / refactor for – Changes to letter values? – Changes to bonus squares?
32
Scrabble? How did you design for change? Could you redesign / refactor for – Changes to letter values? – Changes to bonus squares? – AI opponents?
33
Scrabble? How did you design for change? Could you redesign / refactor for – Changes to letter values? – Changes to bonus squares? – AI opponents? – Different dictionaries?
34
Summary Designing for change is a matter of: – Controlling dependency – Proper encapsulation – Generalizing where you can More broadly, you are asking: – What are the biggest change risks? – What kind of program is this, essentially? – Where is “the line”?
35
Assignment #1 Continued We’ll exchange designs now Review forms will be online tonight Send completed forms to Andre and I – abaker@ics.uci.edu – andre@ics.uci.edu – Due 6:00 pm, Sunday
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.