|
|
|
|
|
by necovek
1914 days ago
|
|
I think binary operator overloading is a bit of a stretch here and it usually has clear rules in whatever language you choose. But the more general question of where to put `combine_with()` in `A.combine_with(B)` is on neither (and not necessarily on another object either). Unfortunately, this is prevalent in OOP programming but it is simply bad architecture. Of course, with it being so common, it's natural to blame OOP programming, because—in a way—it lets people get away with it easily. As others have pointed out, the most pragmatic approach is the most reasonable one: use functional paradigms where they make more sense, OO-ones where they do. When things stop making sense (as in your example), don't do it! To best understand what things make sense, start doing TDD and you'll quickly learn to de-couple things that don't need to be coupled (even if you don't end up doing TDD all the time). |
|