[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: The problem of History Objects
I would use the following design:
__________ ____________________ _______________
| | 1...1 |HomeAddressManager| 1...*| |
| Person |--------------- | |--------|HomeAddress |
| | | | | |
---------- -------------------- ---------------
|
|
|1...1
______________
| |
| TimePeriod |
| |
--------------
It is HomeAddressManager's responsibility to define, and maintain the
relationship between Person and HomeAddress. To do that, HomeAddressManager
provides the following services:
HomeAddress getFirstValidAddress();
HomeAddress getNextValidAddress();
This couple of services allows the client to retrieve all available valid
addresses of a Person. In you case, you might want to make a class deriving
from HomeAddressManager, named, say, HomeAddressManager1, to implement the
constraint that one Person can have only one current address.
HomeAddressManager1 provides a service called
HomeAddress getCurrentAddress();
And overloads getFirstValidAddress() to use the return value
getCurrentAddress(), and getNextValidAddress() to simply return null.
Jing
-----
Jing Xue
* Let's work the problem, people! Let's not make things worse by guessing.
* -- Gene Kranz, "Apollo 13"
>
> __________ __________________ _______________
> | | 1...* |HomeAddressTimer | 1...1| |
> | Person |--------------- | |--------|HomeAddress |
> | | | | | |
> ---------- ------------------| ---------------
> | |
> | |
> |1...1 |1...1
> ______________ _____________
> | | | |
> | TimePeriod | | Valid |
> | | | |
> -------------- -------------
>
To unsubscribe send a note to majordomo@cs.fiu.edu with the body of the message
being: unsubscribe cadse-orb