+ All Categories
Home > Documents > Informatics 122 Software Design II

Informatics 122 Software Design II

Date post: 19-Mar-2016
Category:
Upload: yates
View: 35 times
Download: 0 times
Share this document with a friend
Description:
Informatics 122 Software Design II. Lecture 3 Emily Navarro Duplication of course material for any commercial purpose without the explicit written permission of the professor is prohibited. Today ’ s Lecture. Designing for change Design examples Assignment 1 continued. - PowerPoint PPT Presentation
Popular Tags:
54
+ Informatics 122 Software Design II Lecture 3 Emily Navarro Duplication of course material for any commercial purpose without the explicit written permission of the professor is prohibited. 1
Transcript
Page 1: Informatics 122 Software Design II

+

Informatics 122Software Design IILecture 3Emily Navarro

Duplication of course material for any commercial purpose without the explicit written permission of the professor is prohibited.

1

Page 2: Informatics 122 Software Design II

+ Today’s Lecture

Designing for change

Design examples

Assignment 1 continued

2

Page 3: Informatics 122 Software Design II

+ Purpose of Implementation Design An implementation design is a road map

understandable, unambiguous, consistent, helpful, …

An implementation design describes a path from application / interaction / architecture design to the product 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

Page 4: Informatics 122 Software Design II

+ Emphasis: Changeability

An implementation design is a road map understandable, unambiguous, consistent, helpful, …

An implementation design describes a path from application / interaction / architecture design to the product 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, …

4

Page 5: Informatics 122 Software Design II

+ Changeability

Subtle Requires foresight and careful balancing Understandable, unambiguous, consistent,

helpful, verifiable, partitionable, recomposable, resilient, evolvable…

Page 6: Informatics 122 Software Design II

+ Your Brainstorming: Changeability

Reusable Upgradable Maintainable Extensible Separates concerns

(modular)

Readable Organized Simple Understandable

Secure Efficient Fast Clever Elegant

Page 7: Informatics 122 Software Design II

+ 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

e.g., adapter, interpreter, observer

Information Hiding

Page 8: Informatics 122 Software Design II

+ Low Coupling/High Cohesion

vs.

Page 9: Informatics 122 Software Design II

+ Information Hiding Made Very Simple A List class with:

1) getArray() : Array2) getElementAt(int i) : Object

Page 10: Informatics 122 Software Design II

+ Information Hiding Made Very Simple A List class with:

1) getArray() : Array2) getElementAt(int i) : Object

It’s too slow, so we switch to a hash table1) Everywhere you call getArray needs changing2) Only List is changed (changes propagate exponentially)

Little things like this add up

Page 11: Informatics 122 Software Design II

+ Why the Emphasis on Changability?

Why not just do it right the first time? Change abounds…

During coding During use Reuse for later projects

Page 12: Informatics 122 Software Design II

+ Why is there so Much Change?

Designs

Outcomes

ok with customer feasible to build

Page 13: Informatics 122 Software Design II

+ Why is there so Much Change?

Designs

Outcomes

Engineering

PhysicsPrinciplesExisting Examples

ok with customer feasible to build

Page 14: Informatics 122 Software Design II

+ Why is there so Much Change?

Designs

Outcomes

Software Engineering

PhysicsPrinciplesExisting Examples

ok with customer feasible to build

Page 15: Informatics 122 Software Design II

+ Why is there so Much Change?

Designs

Outcomes

Software Engineering

PhysicsPrinciplesExisting Examples

ok with customer feasible to build

Page 16: Informatics 122 Software Design II

+ Why is there so Much Change?

Designs

Outcomes

Software Engineering

PhysicsPrinciplesExisting Examples

ok with customer feasible to build

Page 17: Informatics 122 Software Design II

+ Why the Emphasis on Changability?

Change abounds… During coding During use Reuse for later projects

You usually just don’t know for sure…

Page 18: Informatics 122 Software Design II

+ 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?

Page 19: Informatics 122 Software Design II

+ Changes During Use

Potential breakdowns at several levels

Customers have needs

Customers make requests

Operating environments change

Page 20: Informatics 122 Software Design II

+ Changes During Reuse

A changing of context

Page 21: Informatics 122 Software Design II

+ Change Happens

Let’s design for it

Page 22: Informatics 122 Software Design II

+ Our Approach

Lots of examples (3 problems, many solutions, today)

Some overarching lessons

Build up an intuition

Page 23: Informatics 122 Software Design II

+ Design Examples

1. Theseus and the Minotaur

2. Klax

3. Scrabble

Page 24: Informatics 122 Software Design II

+ Example #1: Theseus and the Minotaur

http://www.logicmazes.com/theseus.html

Page 25: Informatics 122 Software Design II

+ Original Theseus Design

Page 26: Informatics 122 Software Design II

+ Original Theseus Design

What if we want to add “water” ?

Page 27: Informatics 122 Software Design II

+ Original Theseus Design What if we want to add “water”?

?

Page 28: Informatics 122 Software Design II

+ Original Theseus Design What if we want to add “water”?

?

How do we fix this?

Page 29: Informatics 122 Software Design II

+ TntM: Changes

Changing the board size

Adding terrain types

Adding more monsters

Adding a second player

“Intelligent elements”

Page 30: Informatics 122 Software Design II

+ TntM 2

Page 31: Informatics 122 Software Design II

+ TntM 2: Object Interfaces & Inheritance

Page 32: Informatics 122 Software Design II

+ TntM: Changes

Changing the board size

Adding terrain types

Adding more monsters

Adding a second player

“Intelligent elements”

Page 33: Informatics 122 Software Design II

+ How far is too far?

Changing board size?

Pushable blocks?

Intelligent elements?

Physics challenges?

Page 34: Informatics 122 Software Design II

+ TntM 2

Page 35: Informatics 122 Software Design II

+ 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?

Page 36: Informatics 122 Software Design II

Example: KLAX Video Game KLAX Chute

Tiles of random colors drop one cell at a time, starting at random times and locations

KLAX Palette Palette manipulated to catch tiles coming

down the Chute and to drop them into the Well

KLAX Well Horizontal, vertical and diagonal sets of

three or more consecutive tiles of the same color are removed, and any tiles above them collapse down to fill in the newly-created empty spaces

KLAX Status Points scored as sets are formed Lives lost as Well or Palette spills over

Page 37: Informatics 122 Software Design II

+ A Good Klax Design?

Page 38: Informatics 122 Software Design II

+ Chiron 2 Architectural Style

Page 39: Informatics 122 Software Design II

+

C2 Klax

Page 40: Informatics 122 Software Design II

+

Spelling Klax?

Page 41: Informatics 122 Software Design II

+

Spelling Klax?

Page 42: Informatics 122 Software Design II

+ Example #3: Scrabble

Page 43: Informatics 122 Software Design II

+ Function Overload

Changes to rack?

Page 44: Informatics 122 Software Design II

+ Class Overload

Page 45: Informatics 122 Software Design II

+ (besides missing details)

Page 46: Informatics 122 Software Design II

+ Is this a good design?

Page 47: Informatics 122 Software Design II

+ Overengineered?

What change are you designing for?

More types of board objects?

Up to 100/60 different types of tiles/bonuses?

Page 48: Informatics 122 Software Design II

+ Overengineered?

Meanwhile:

Board doesn’t actually work

Populating the tiles is likely a hassle

Tilepool vs. Player.currentTiles

Inelegance lead to problems

Page 49: Informatics 122 Software Design II

+ A Nice Approach?

Page 50: Informatics 122 Software Design II

+ A Nice Approach?

Page 51: Informatics 122 Software Design II

+ Scrabble Changeability Can a design accommodate:

Changes to letter values?

Changes to bonus squares?

AI opponents?

Different dictionaries?

Different languages?

Page 52: Informatics 122 Software Design II

+ Summary Designing for change is a matter of:

Controlling dependency Proper encapsulation Generalizing where you can

Which changes? What are the biggest change risks? What kind of program is this, essentially? Where is “the line”?

What do we know we will have? Put this in an interface

What variations on that might we see? Hide this behind the interface

Page 53: Informatics 122 Software Design II

+ Practically:

What is the core we know will be true? What variations on that will we see?

If there’s something that needs to change: Can it be changed in one place? Does anything else need to be changed when it changes?

Can each class ignore its context?

Discipline

Page 54: Informatics 122 Software Design II

+ Assignment #1 Continued

Now that we have talked through some examples, improve upon your design based upon what you have seen today.

On Thursday, 1/16, bring FIVE copies of your improved design One with your name and ID on it Four anonymized copies with a number on each that I will email to

you


Recommended