From: Jesse Houwing on
* Peter Duniho wrote, On 20-1-2010 0:24:
> Jesse Houwing wrote:
>> If you take the elevator idea (it is a nice concept), then you don't
>> need to maintain which person wants to go where. Just that a person
>> wants to go there. And then the elevator can notify each person that
>> it has arrived on a certain floor.
>
> How can it notify each Person instance if it doesn't keep track of each
> Person instance? _Some_ code has to track the instances, and it could
> just as easily be the elevator. Otherwise, each Person instance needs to
> repeatedly poll the elevator to see if it's at the correct floor yet.

I didn't mean that the elevator would not contain a list of persons that
are in the elevator. But it would seem illogical to maintain a
collection of <person requester, int floor>. A person would know when to
get out when it's notified that the elevator has arrived on a certain floor.


> I agree with your sentiment to an extent. But the class _does_ retain
> the reference to a person, so arguing that maintaining a single Person
> instance is okay while maintaining multiple Person instances is not
> cannot be done on _that_ basis.

It was the sentence "associate requested floors with people" that
triggered my response. There is no apparent need to keep track of who
asked to go where.

So it seems we agree in full :).

(Though a good lift-boy would know who asked to go where and say: "Mr
Duniho, we've arrived on your floor, have a good day sir!" ;)) and would
just ignore the other passengers.

I guess the Lift-boy would model very nicely as a controller class.

--
Jesse Houwing
jesse.houwing at sogeti.nl
From: Arne Vajhøj on
On 20-01-2010 12:16, Paul Shapiro wrote:
> "Jesse Houwing" <jesse.houwing(a)newsgroup.nospam> wrote in message
> news:uZnSr#VmKHA.2188(a)TK2MSFTNGP04.phx.gbl...
>> * Peter Duniho wrote, On 20-1-2010 0:24:
>>> I agree with your sentiment to an extent. But the class _does_ retain
>>> the reference to a person, so arguing that maintaining a single Person
>>> instance is okay while maintaining multiple Person instances is not
>>> cannot be done on _that_ basis.
>>
>> It was the sentence "associate requested floors with people" that
>> triggered my response. There is no apparent need to keep track of who
>> asked to go where.
>>
>> So it seems we agree in full :).
>>
>> (Though a good lift-boy would know who asked to go where and say: "Mr
>> Duniho, we've arrived on your floor, have a good day sir!" ;)) and
>> would just ignore the other passengers.
>>
>> I guess the Lift-boy would model very nicely as a controller class.
>
> In a data model I could see 3 objects:
> Elevator(elevatorID, location, currentFloor, directionOfTravel, etc.)
> Person(personID, lastName, firstName, etc.)
> ElevatorPassenger(elevatorID, personID, requestedFloor)

That structure looks more as an "in database" data structure
than as an "in memory" data structure.

Arne