3 ms·
I am not sure about his example of large classes. If "energy()" is an integral part of the model, why shouldn't it be a method of it? Maybe the example is not w
by pvitz 6y ago
I am not sure about his example of large classes. If "energy()" is an integral part of the model, why shouldn't it be a method of it? Maybe the example is not well chosen, but it looks more like extreme minimalism to me. If there are different kind of models (like Ising and XY), they could all implement the same interface with an energy method. Any views on this?
- wutbrodo 6y ago>If there are different kind of models (like Ising and XY), they could all implement the same interface with an energy method. Any views on this? If it's necessary for the interface, then it should of course be in the interface. But he was referring to the unnecessary placement of internal implementation functions into the class. This is all over the current codebase and it drives me _crazy_. In a healthy codebase, a header file is the best documentation yiu can have of a class, and polluting it with unnecessary functions that have no meaning to the user makes it harder to read and reason about.
- pvitz 6y agoI still don't understand why the magnetization or the energy of the Ising model should be "unnecessary internal implementation functions" when they are the actual outputs of the model. Thinking more about it, the example is (almost) a value object class. I don't think this is well-chosen for making a point about bloated classes.