Hacker News new | ask | show | jobs
by TimMurnaghan 2147 days ago
That's true - but where do you put the function? In a complex system I can end up with loads of these totalling functions scattered about. I might have gross and net versions of the total and, given human nature, they get created near the use of them. The variants then get duplicated. The objects give you a modular structure which means you can see the interface.There is a disconnect when you have to shift to the object - but you can also see when to refactor.
1 comments

There are a few answers for this: you might include common ones in the same file as the struct (see rust for how this looks, usually).