1
17-214
School of Computer Science
Object-oriented analysis: Modeling a problem domain Charlie Garrod - - PowerPoint PPT Presentation
Principles of Software Construction: Objects, Design, and Concurrency Part 2: Designing (Sub-)Systems Object-oriented analysis: Modeling a problem domain Charlie Garrod Bogdan Vasilescu School of Computer Science 17-214 1 GUIs UML More
1
17-214
School of Computer Science
2
17-214
Part 1: Design at a Class Level Design for Change: Information Hiding, Contracts, Unit Testing, Design Patterns Design for Reuse: Inheritance, Delegation, Immutability, LSP, Design Patterns Part 2: Designing (Sub)systems Understanding the Problem Responsibility Assignment, Design Patterns, GUI vs Core, Design Case Studies Testing Subsystems Design for Reuse at Scale: Frameworks and APIs Part 3: Designing Concurrent Systems Concurrency Primitives, Synchronization Designing Abstractions for Concurrency
3
17-214
4
17-214
5
17-214
Context +operation() Leaf +operation() +add(in c : Component) +remove(in c : Component) Composite +operation() «interface» Component
1
*
for (c in children) c.operation(); }
6
17-214
7
17-214
Stack s = new Stack();
UndoStack s = new UndoStack(new Stack());
SecureStack s = new SecureStack(new SynchronizedStack(new UndoStack(new Stack())));
8
17-214
10
17-214
§
Fails to implement the specifications … Satisfies all of the specifications
§
Will crash on any anomalous event … Recovers from all anomalous events
§
Must be replaced entirely if spec changes … Easily adaptable to changes
§
Cannot be used in another application … Usable without modification
§
Fails to satisfy speed or storage requirement … satisfies requirements
§
Cannot be used as the basis of a larger version … is an outstanding basis…
§
Security not accounted for at all … No manner of breaching security is known
Source: Braude, Bernstein, Software Engineering. Wiley 2011
11
17-214
12
17-214
13
17-214
14
17-214
15
17-214
16
17-214
17
17-214
18
17-214
19
17-214
?
?
20
17-214
Obj1 a h k() Obj2
… Actor42
21
17-214
PineTree age height harvest() Forest
… Ranger
surveyForest(…)
22
17-214
23
17-214
PineTree age height harvest() Forest
… Ranger
surveyForest(…)
24
17-214
25
17-214
27
17-214
28
17-214
29
17-214
30
17-214
31
17-214
32
17-214
33
17-214
34
17-214
35
17-214
36
17-214
37
17-214
38
17-214
39
17-214
PineTree age height harvest() Forest
… Ranger
surveyForest(…)
Domain Model
Object Model
40
17-214
41
17-214
42
17-214
43
17-214
44
17-214
45
17-214
46
17-214
47
17-214
48
17-214
49
17-214
50
17-214
51
17-214
52
17-214
53
17-214
54
17-214
– for communication among developers, testers, clients, domain experts, … – Agree on a single vocabulary, visualize it
– ideas, things, objects – Give it a name, define it and give examples (symbol, intension, extension) – Add glossary – Some might be implemented as classes, other might not
– that’s okay – start with a partial model, model what's needed – extend with additional information later – communicate changes clearly – otherwise danger of "analysis paralysis"
55
17-214
– Domain models – understand domain and vocabulary – System sequence diagrams + behavioral contracts – understand interactions with environment
– Elide obvious(?) details – Iterate, iterate, iterate, …
– Low representational gap principle to support design for understanding and change – Some domain classes don’t need to be modeled in code; other concepts only live at the code level
– Use only domain-level concepts