An object-oriented application is driven by a set of collaborating objects, each one of which has some responsibility to fulfill. The application delegates to each object its own share of the overall task to be accomplished. Typically, the application starts by delegating the overall task to one or more objects. This means that the program starts by requesting some service(s) from these objects.
These objects carry out their responsibilities, and can delegate part of their work to other objects. The chain of delegations continues until there is no more work needed to delegate.
This approach of object-oriented design is called the responsibility-driven design because the responsibilities of the objects are identified first in the software development process. The principle of information hiding supports this design approach. Every object advertises the task it can carry out but without
In modeling object-oriented applications, one of the first
A model is an abstract representation of a real system. Modeling is the process of constructing representations of objects and defining the common characteristics into classes. Modeling involves what objects and relevant characteristics of these objects are to be included in the model.
Objects collaborate by sending messages to each other. A message is request to to carry out a certain operation by an object. Information hiding emphasizes the separation of the list of operations that an object offers to other objects from the implementation details that are hidden to other objects.
|
models |
abstraction |
objects |
|
collections |
real-world entities |
object state |
|
object behavior |
messages |
attributes |
|
operations |
|
functions |
|
UML diagram |
interactions |
method invocation |
|
classes |
encapsulation |
information hiding |
|
private |
public |
responsibilities |
|
delegations |
collaboration |
Explain and give examples of the difference between classes and objects. Why is the object considered a dynamic concept? Why is the class
Explain why the UML class and object diagrams are very similar. What do these diagrams actually describe about an object and about a class? Explain.
Explain and give examples of object behavior. Is object interaction the same as object behavior? Explain and give examples. What UML diagram describes this? If an object-oriented application has only one object, is there any object interaction? Explain.
What are the differences between encapsulation and information hiding? How are these two concepts
From the principle of information hiding, why are the two views of an object at different levels of abstraction? Explain. How useful can this principle be in software development?
Consider an automobile rental office. A customer can rent an automobile for a number of days and with a finite number of miles (or kilometers). Identify the type and number of objects involved. For every type of object, list the properties and operations. Draw the class and object diagrams for this problem. As a starting point, use class Automobile described in this chapter.
For the automobile rental office, describe the object interactions necessary. Draw the corresponding collaboration diagrams.
Consider a movie rental shop. Identify the various objects. How many objects of each type are there? List the properties and the necessary operations of the objects. Draw the corresponding UML diagrams for this problem.
For the two problems described in Exercises 7 and 8, list the private and public characteristics (properties and operations) for every type of object. Why do you need to make this distinction? Explain.