Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 17. Initial Object Design Inputs: requirements meetings various Use Cases – 10% complete Key risks addressed with preliminary programming System.

Similar presentations


Presentation on theme: "Chapter 17. Initial Object Design Inputs: requirements meetings various Use Cases – 10% complete Key risks addressed with preliminary programming System."— Presentation transcript:

1 Chapter 17

2 Initial Object Design Inputs: requirements meetings various Use Cases – 10% complete Key risks addressed with preliminary programming System Sequence Diagrams The Domain Model Glossary Use Case post-conditions clarify proposed achievements.

3 Object Design Activities: Test-first development (test code production code) Some UML modeling Sequence Diagrams concurrent with Class Diagrams Apply GRASP principles and GoF Design Patterns Follow RDD – responsibility-driven design Class diagrams are intended for understanding, not documentation

4 Object Design Outcome: Add methods to appropriate classes. This simplistic description hides the deep principles and issues involved and he consequences of getting it wrong.

5 Fig. 17.1 inputs and outputs of a day of design

6 Responsibility-Driven Design (RDD): Think in terms of responsibilities, roles and collaborations Two kinds: – doing – knowing Think about responsibility “granularity” Responsibilities happen in conjunction with collaborations between objects.

7 Responsibility-Driven Design (RDD): Doing: –doing something itself –initiating action in others –controlling or coordinating activities across various objects

8 Responsibility-Driven Design (RDD): Knowing: –knowing about private data –knowing about related objects –knowing about secondary data it can calculate (result of a method call)

9 Guidelines: Domain Model guides what classes “know” Results in “low representational gap” keep your eye on responsibility “granularity” –big responsibilities get spread over many classes –small responsibilities may take only one method Collaboration is everywhere – methods talk to one another

10 RDD as Metaphor: An OO Design seen as a community of collaborating responsible objects.

11 GRASP: General Responsibility Assignment Software Patterns or Principles Basic principles to follow when assigning responsibilities Used in place of experience based on recognized successful patterns

12 GRASP Principles: Information Expert: assign responsibility to the knowledgeable class; the one with the necessary info Creator: Creation responsibility goes to the class that –contains an object –aggregates an object –has initializing data Controller: A class that represents the overall system, “root”, a device, a subsystem or a Use Case goal. This is the first class beyond the UI. Low Coupling: Keep unnecessary coupling to a minimum. Typically one of many alternatives.

13 GRASP Principles: High Cohesion: assign responsibility so cohesion remains high. Typically one of many alternatives. Polymorphism: Assign responsibilities as behaviour varies by type. Use polymorphism. Pure Fabrication: When a highly cohesive set of behaviours needs a home and no domain object does it. Indirection: Use an intermediate object when you don't want to classes to know about each other. Protected Variations: Protecting against instability if variations need frequent tweaking. Identify places of predictable instability and protect them with an interface.

14 Fig. 17.2 What GRASP principles are applied here?

15 Patterns: A pattern is a named description of a problem and its solution that can be applied to new contexts. Naming a pattern is important. If you can't name it you don't understand it. Patterns are all old friends. Keep to the tried and true. “New” pattern is an oxymoron. Own the GoF book – Design Patterns

16 Fig. 17.3 What GRASP patterns are in use?

17 Fig. 17.5 Board aggregates Square. Start there.

18 Find the GRASP patterns in use here: Creator: Board creates Square (LRG) since it aggregates squares. Information expert: To retrieve one square one needs to know about all squares. This is Board's job as aggregator. Low Coupling: Knowing about squares as a collection and then individually means low coupling. Controller: High Cohesion:

19 Fig. 17.4

20 Fig. 17.6

21 Find the GRASP patterns in use here: Low Coupling: Knowing about squares as a collection and then individually means low coupling. Controller: High Cohesion:

22 Fig. 17.7

23 Fig. 17.8

24 Fig. 17.9

25 Fig. 17.10

26 Fig. 17.11

27 Fig. 17.12

28

29 Fig. 17.13

30

31 Fig. 17.14

32

33 Fig. 17.15

34

35 Fig. 17.16

36

37 Fig. 17.17

38

39 Fig. 17.18

40

41 Fig. 17.19

42

43 Fig. 17.20

44

45 Fig. 17.21

46

47 Fig. 17.22

48

49 Fig. 17.23

50

51 Fig. 17.24

52

53 Fig. 17.25

54

55 Fig. 17.26

56

57 Fig. 17.27

58


Download ppt "Chapter 17. Initial Object Design Inputs: requirements meetings various Use Cases – 10% complete Key risks addressed with preliminary programming System."

Similar presentations


Ads by Google