3 ms·
Furthermore, a car necessarily encapsulates it's passengers while transporting them from one state to another and may allow one or more passengers to temporaril
by itronitron 7y ago
Furthermore, a car necessarily encapsulates it's passengers while transporting them from one state to another and may allow one or more passengers to temporarily un-encapsulate while parked at a rest stop along an interstate highway. The car as an encapsulation of passengers has come under criticism by some for allowing this temporary un-encapsulation however others consider this a positive attribute and note the behavior is typically only observed shortly after crossing state boundaries and for a limited duration relative to the total time of encapsulation.
- XuMiao 7y agoOOP is essentially relational programming. It programs relations among objects. The encapsulation should be on the logic of relationship. Transport is a relationship between passenger, viechle and state. Some passenger transports with a car, others by foot. It's the Transport's responsibility to update the states of passenger and viechle. Encapsulation on entities sometimes is not enough to make a good OOD.