Object Design Roles, Responsibilities and Collaborations Flashcards

1
Q

OO: What is an application?

A

a set of interacting objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

OO: What is an object?

A

an implementation of one or more roles. An object embodies a set of roles with a designated set of responsibilities.

“The object has three properties, which makes it a simple, yet powerful model building block. It has state so it can model memory. It has behavior, so that it can model dynamic processes. And it is encapsulated, so that it can hide complexity.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

OO: What is a role?

A

a set of related responsibilities. A role is a set of responsibilities that can be used interchangeably.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

OO: What is a responsibility?

A

an obligation to perform a task or know information

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

OO: What is a collaboration?

A

an interaction of objects or roles (or both)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

OO: What is a contract?

A

an agreement outlining the terms of a collaboration. An object contract describes the conditions under which it guarantees its work and the effects it leaves behind when its work is complete.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

OO: What is the difference between an object and a role?

A

When a role
is always played by the same kind of object, the two are equivalent. But if more than one kind of object can fulfill the
same responsibilities within the community, a role becomes a set of responsibilities that can be fulfilled in different
ways. A role is a slot in the software machinery to be filled with an appropriate object as the program runs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

OO: Why do we use Object Role StereoTypes?

A

Because our goal is to build consistent and easy-to-use objects, it is advantageous to stereotype objects, ignoring specifics of their behaviors and thinking about them at a higher level. By oversimplifying and characterizing it, we can ponder the nature of an object’s role more easily.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

OO: List 6 useful Object Role Stereotypes.

A

Information holder—knows and provides information

Structurer—maintains relationships between objects and information about those relationships

Service provider—performs work and, in general, offers computing services

Coordinator—reacts to events by delegating tasks to others

Controller—makes decisions and closely directs others’ actions

Interfacer—transforms information and requests between distinct parts of our system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

OO: What happens when an object falls into multiple object role stereotypes? How do you decide which one to take?

A

Some objects are hard to stereotype because they seem to fit into more than one category. They’re fuzzy. How can you choose? You must decide what you want to emphasize. A transmission is a service provider if you emphasize the multiplication of power by the gears. It is an interfacer if you emphasize its connections to the engine and wheels.
Can objects have more than one stereotype? If you want to emphasize more than one aspect, that’s OK. There are blends of stereotypes, just as there are blends of emphasis.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

OO: What are Domain Objects?

A

Domain objects provide a common ground in which developers and users can meet and discuss the application. Domain objects represent concepts that are familiar to users and experts in a specific field of interest.
For the developers, these domain objects are only the starting point for constructing a model of the domain and for developing the internal representations of these and additional concepts that will exist in the software machinery. Although the original, “common” concepts might not prove valuable in the executable system, they should be traceable through the design because they clearly express the stakeholders’ understanding and issues surrounding the application.
A domain model does not represent the entire domain as it is in the real world. It includes only the concepts that are needed to support the application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

OO: What are Application-Specific Objects?

A

An application model supplements the domain model with computer-specific objects for responding to the user, controlling execution, and connecting to outside resources.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

OO: What is a Class? What are the roles of a class?

A

Classes play two roles. First, they act as factories, instantiating instances and implementing responsibilities on their behalf (constructor). Second, they act as an independent provider, serving clients in their neighborhood (methods)

Classes hold the “shape” of the objects that they make.

Relations among classes describe the myriad potential relations among run-time instances.

A class can also act as an object when the application needs only one of its kind (static).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the two types of relationships in an object model? Explain the difference.

A

There are only two types of relationships in an object model: composition and inheritance.

Both have analogs in a family tree. A composition relation is like a marriage between objects. It is dynamic, it happens during the participating objects’ lifetimes, and it can change. Objects can discard partners and get new partners to collaborate with. Inheritance relations are more like births into the family. Once it happens, it is forever. Just as both marriage and ancestry appear in the same family tree, composition and inheritance coexist in a single object model.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly