550 likes | 694 Views
Week 2 Design Examples and Designing for Change. Alex Baker. 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
E N D
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, …
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, …
Emphasis: Changability • Reusable • Extensible • Maintainable • Portable • Well-Documented • Adaptable • Simplicity • Readability • Minimalistic • Elegant • Well-Organized • Concise • Efficiency • Powerful
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
Information Hiding Made Very Simple • A List class with: • getArray() : Array • getElementAt(int i) : Element
Information Hiding Made Very Simple • A List class with: • getArray() : Array • getElementAt(int i) : Element • Its too slow, so we switch to a hash table • Everywhere you call getArray needs changing • Only List is changed • Little things like this add up
The Ideal Program vs. …
Why the Emphasis on Changability? • Change abounds… • During coding • After use • Reuse for later projects
Why is there so Much Change? Designs Outcomes
Why is there so Much Change? Engineering Designs Outcomes Physics Principles Existing Examples
Why is there so Much Change? Software Engineering Designs Outcomes Physics Principles Existing Examples
Why is there so Much Change? Software Engineering Designs Outcomes Physics Principles Existing Examples
Why is there so Much Change? Software Engineering Designs Outcomes Physics Principles Existing Examples
Why the Emphasis on Changability? • Change abounds… • During coding • After use • Reuse for later projects • You usually just don’t know for sure…
Changes During Coding • Refinement of the high level design • Dependencies reveal themselves • Oh, I need to know [X]. • I can’t access that data? • ‘It turns out this class is HUGE’ • Need to redesign as you go • Can changes be made within the design?
Changes during Use • Potential breakdowns at several levels • Customers have needs • Customers make requests • Developers provide software
Reuse • A changing of context • …
Change Happens • Let’s design for it
Our Approach • Lots of examples (3 problems, many solutions, today) • Some overarching lessons • Build up an intuition
UML Review: Class Diagrams Class Name Attribute : Type Attribute : Type Operation (parameter) : Return Type Operation (parameter) : Return Type Operation (parameter) : Return Type
UML Review: Class Diagrams Association Generalization Aggregation Composition
Example #1: Theseus and the Minotaur • http://www.logicmazes.com/theseus.html
Original Theseus Design • What if we want to add “Water” ?
Original Theseus Design • What if we want to add “Water” ? ?
Original Theseus Design • What if we want to add “Water” ? • How do we fix this? ?
TntM: Changes • Changing the board size • Adding terrain types • Adding more monsters • Adding a second player • “Intelligent elements”
TntM: Changes • Changing the board size • Adding terrain types • Adding more monsters • Adding a second player • “Intelligent elements”
How far is too far? • Changing board size? • Pushable blocks? • Intelligent elements? • Real time gameplay? • Physics challenges?
Bonus! • StompOn( stompee ) Or • StompedOn( stomper )
Aside: Three Degrees of Support • Is it a good solution? • Can they build that solution? • Can that solution be used to make other good solutions?
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
Function Overload Changes to rack
Overengineered? What change are you designing for?Multiple point values for a given tile type?More types of board objects?
Overengineered? Meanwhile:Board doesn’t actually workPopulating the tiles is likely a hassleTilepool vs. Player.currentTilesInelegance lead to problems