Better HN
topnewbestaskshowjobs
Log inSign up

username56283

2 karma · joined Jan 4, 2015 (11y ago) · 2 submissions

Submissions

comment 11y ago · link · parent

What methods is this heating strategy going to call on water and stove? Consider for example that the stove builds up rust. Therefore it needs to know the properties of what's inside. Is the heating strategy going to tell it that?

comment 11y ago · link · parent

What (from a code organization perspective) might work better in practice is:

    water.heat(stove);
because it's the water that's being changed and change should be encapsulated. On the other hand, the stove may also change in the process. In fact, the water and the stove do things to each other. Then what makes either of the two options more appropriate? Similar issues arise with a method called sendMessage; is the object having this method now supposed to send a message or to receive a message?