Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

OOP 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.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: