| ▲ | burakemir 2 hours ago | |
Say you have a Car, Engine and Dashboard object. Let's not have dashboard access the temperature by doing `GetSurroundingCar().engine.temperature` If the dashboard needs to get the temperature from a sensor in the engine, it should be able to "talk" to the sensor, without going through car object. In ideal OOP, a "method call o.m(...)" is considered a message m being sent to o. In practice, field access, value and "data objects" etc are useful. OOP purism isn't necessarily helping if taken to the extreme. The pure OOP idea emphasizes that the structure of a program (how things are composed) should be based on interactions between "units of behavior". | ||