 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
A
central role of object oriented design is to group each
|
|
|
operation
with one class
|
|
|
| • |
Each
operation must have exactly one class that is
|
|
|
responsible
for carrying it out
|
|
|
| • |
This
means you must be careful to not have one class act
|
|
|
on
the data of another class.
|
|
|
| • |
For
example, if we had a message class which allowed a
|
|
|
message
to be left, erased, or played. What would be
|
|
|
wrong
with adding this message to a mailbox of
|
|
|
messages?
How could a message add itself to a mailbox?
|
|
|
A
mailbox, instead could add a message! This would have
|
|
required
a message to know the internal mailbox
|
|
|
structure
|
|