4 ms·
A paradigm/framework analogy: Cars are great, but you probably don't need a car ferry just to cross the water. And sometimes a bike is better then a car in a ca
by z3t4 7y ago
A paradigm/framework analogy: Cars are great, but you probably don't need a car ferry just to cross the water. And sometimes a bike is better then a car in a car trailer.
- itronitron 7y agoFurthermore, 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.