It's not against OO - the behavior is encapsulated, hiding complex behavior behind a simple API. (or the message protocol, as we call it in Smalltalk).
There is a lot of code duplication. One could apply a layer of indirection and save the code in one common place - but this is an example of the sacrifice of compactness for speed - trading from a memory location for speed. It also trades speed at the expense of OnceAndOnlyOnce , which, in my opinion, is your fundamental problem.
In the first Smalltalk, I used LearningWorks (based on the implementation of ParcPlace, iirc) function - just negated with an argument, and then called the + function. This made the operation - slower than operation + .
There are many potential tradeoffs and optimizations in software development β the main ones are memory speed (and vice versa), execution speed for development speed (and vice versa), and the ease of getting something working right now, as opposed to being lightweight to make it work and tuned for a long time.
OO development is usually optimized around optimizing development speed at the expense of execution speed, using high-level languages ββthat are faster to develop, but that work slower; optimization for long-term maintainability compared to immediacy; and using as much memory as possible to squeeze as much performance out of naturally slow code as possible.
This, however, is a generalization. For all these are counter examples, I'm sure.
source share