Week 3,4,5: Static and Dynamic Modeling

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/55

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

56 Terms

1
New cards

What is the purpose of the Creator pattern?

To assign responsibility for creating instances of a class A to a class B under specific conditions, supporting low coupling and reuse.

2
New cards

List the four conditions that make class B a suitable Creator of class A.

B contains or compositely aggregates A; B records A; B closely uses A; B has the initializing data for A.

3
New cards

Give an example of the Creator pattern from the Monopoly case study.

Board creates Square objects because it aggregates them and has the initializing data (square names).

4
New cards

What are the contraindications for using the Creator pattern?

When object creation is complex (recycled instances, conditional or family-based creation); use Factory or Builder patterns instead.

5
New cards

What problem does the Information Expert pattern solve?

Determines which object should have a responsibility based on where the necessary information resides.

6
New cards

State the Information Expert pattern solution.

Assign a responsibility to object X if X has or can access the information needed to fulfill that responsibility.

7
New cards

Provide an example of Information Expert from the POS system.

SaleLineItem calculates its own subtotal because it has access to quantity and price (via ProductDescription).

8
New cards

What are the contraindications for Information Expert?

When following Expert creates undesirable dependencies (e.g., spreading database logic across domain classes); use Pure Fabrication instead.

9
New cards

What is the goal of the Low Coupling principle?

Minimize dependencies between classes to reduce change impact and improve maintainability and reuse.

10
New cards

Explain the Low Coupling example for Subtotal calculation in POS.

Choosing SaleLineItem over ProductDescription avoids coupling Sale to ProductDescription when totaling subtotals.

11
New cards

What does High Cohesion ensure in class design?

Responsibilities within a class are strongly related, making the class focused, understandable, and maintainable.

12
New cards

Describe the High Cohesion example for payment creation in POS.

Sale creates Payment rather than Register to prevent Register from becoming bloated and maintain cohesive duties.

13
New cards

How do Low Coupling and High Cohesion work together?

They balance each other: low coupling reduces dependencies, high cohesion keeps responsibilities focused; both guide design choices.

14
New cards

Why is responsibility-driven design important in OO modelling?

It aligns software classes and their behaviors with domain concepts, ensuring intuitive and maintainable designs.

15
New cards

Define a software pattern.

A named problem-solution pair based on proven expertise that can be reused in new contexts.

16
New cards

How do patterns improve team communication?

By providing a common vocabulary to explain design decisions and rationale clearly.

17
New cards

What real-world example illustrates the idea of a design pattern?

A bathroom layout pattern includes sink, toilet, and bathtub—a recurring successful solution.

18
New cards

Why should patterns not be applied blindly?

Because each pattern has contraindications and must be weighed against project-specific requirements.

19
New cards

What problem does Indirection solve?

Avoids direct coupling between two (or more) objects by introducing an intermediate mediator.

20
New cards

What is the solution proposed by the Indirection pattern?

Assign the responsibility to an intermediate object that mediates interactions between the dependent and questionable elements.

21
New cards

What is a contraindication of using Indirection?

It can introduce performance overhead in high-performance systems requiring minimal layers of indirection.

22
New cards

In the POS example, which class implements Indirection for tax calculation?

TaxMasterAdapter mediates between Sale and the external TaxMasterSystem.

23
New cards

What problem does Pure Fabrication solve?

Maintains high cohesion and low coupling when no domain class is appropriate for a responsibility.

24
New cards

What is the solution proposed by the Pure Fabrication pattern?

Create an artificial class to hold a cohesive set of responsibilities unrelated to domain concepts.

25
New cards

What is a contraindication of using Pure Fabrication?

Overuse can lead to many tiny classes and excessive coupling between them.

26
New cards

In the Monopoly example, which fabricated class is used for rolling dice?

Cup serves as a fabricated mediator to roll dice and return totals.

27
New cards

What problem does Polymorphism solve?

Eliminates complex conditional logic by varying behavior based on object type, and supports pluggable components.

28
New cards

What is the solution proposed by the Polymorphism pattern?

Define polymorphic operations (same interface) in subclasses to handle type-specific behavior.

29
New cards

What is a contraindication of using Polymorphism?

Applying it speculatively for unlikely future variations can overcomplicate the design.

30
New cards

In the Monopoly example, which operation is polymorphic?

The landedOn() method varies behavior across GoSquare, IncomeTaxSquare, RegularSquare, etc.

31
New cards

What problem does Protected Variation solve?

Protects system elements from variations or instabilities in other components from causing ripple effects.

32
New cards

What is the solution proposed by the Protected Variation pattern?

Identify variation points and create stable interfaces around them, often using indirection and polymorphism.

33
New cards

What is a contraindication of using Protected Variation?

Excessive speculative future-proofing may add unnecessary complexity and cost.

34
New cards

In the POS example, which interface protects variations in tax calculator adapters?

ITaxCalculatorAdapter defines a stable interface for multiple external tax calculator implementations.

35
New cards

Which design principle is equivalent to Protected Variation?

The Open-Closed Principle (OCP) by Bertrand Meyer, stating modules should be open for extension but closed for modification.

36
New cards

How does Indirection contribute to Protected Variation?

It creates a stable mediator to hide interface variations of external components.

37
New cards

How does Polymorphism contribute to Protected Variation?

It allows multiple implementations behind a common interface to handle behavior variations.

38
New cards

What three fundamental principles are related in the GRASP pattern relationships diagram?

Protected Variation, Low Coupling, and High Cohesion form the core goals, achieved using other patterns.

39
New cards
What are the primary object-oriented design models?
Static: Design Class Diagrams; Dynamic: Design Sequence Diagrams.
40
New cards
What is the focus of object-oriented design?
Creating a conceptual solution by defining software objects and their collaboration.
41
New cards
How do domain models relate to design models?
Domain models inspire design models; minimizing the representational gap aligns software classes with domain concepts.
42
New cards
What is the representational gap?
The difference between domain and design models; a smaller gap simplifies maintenance and enhances understanding.
43
New cards
What does a Design Class Diagram show?
Software class names, attributes with data types, method signatures, and associations with multiplicities and navigability.
44
New cards
How does a design class diagram differ from a domain model?
Design diagrams include operations (methods), software data types, and navigability arrows, whereas domain models omit methods and use conceptual data types.
45
New cards
What is Responsibility-Driven Design (RDD)?
An approach that assigns responsibilities and collaborations to software objects to fulfill system requirements.
46
New cards
What are "knowing responsibilities" in RDD?
Obligations of an object to know about its data, related objects, or derived/calculated information.
47
New cards
What are "doing responsibilities" in RDD?
Obligations of an object to perform actions, initiate actions in other objects, or coordinate activities.
48
New cards
What is a Design Sequence Diagram?
A dynamic model illustrating the sequence of messages exchanged between software objects during execution.
49
New cards
What is a "found message" in a sequence diagram?
A message with no specified sender that initiates the interaction in the diagram.
50
New cards
How is delegation represented in a sequence diagram?
One object sends a message to another object to perform an action on its behalf.
51
New cards
How is a loop represented in a sequence diagram?
Using a loop interaction frame with a guard condition label, e.g., [condition].
52
New cards
What are activation bars in a sequence diagram?
Rectangles on lifelines indicating when an object is active (handling a message), useful in complex interactions.
53
New cards
How can design models support code generation?
Attributes map to class fields, method signatures map to methods, and creation responsibilities map to constructors.
54
New cards
In the POS example, what responsibility does the Sale class have regarding line items?
It is responsible for creating SalesLineItem objects via a makeLineItem method.
55
New cards
In the dice game example, what methods are assigned to the DiceGame and Die classes?
DiceGame has play():boolean; Die has roll():void and getFaceValue():int.
56
New cards
Why use consistent UML notation for analysis and design models?
To reduce the representational gap and maintain consistency between static and dynamic model representations.