393
Switching to OCaml bois
(lemmy.world)
Post funny things about programming here! (Or just rant about your favourite programming language.)
Because an object is good at representing a noun, not a verb, and when expressing logical flows and concepts, despite what Java will tell you, not everything is in fact, a noun.
I.e. in OOP languages that do not support functional programming as first class (like Java), you end up with a ton of overhead and unnecessary complications and objects named like
generatorFactoryServiceCreatorFactory
because the language forces you to creat a noun (object) to take an action rather than just create a verb (function) and pass that around.This makes sense to me, thanks! I primarily use Python, C++ and some Fortran, so my typical programs / libraries aren't really "pure" OOP in that sense.
What I write is mostly various mathematical models, so as a rule of thumb, I'll write a class to represent some model, which holds the model parameters and methods to operate on them. If I write generic functions (root solver, integration algorithm, etc.) those won't be classes, because why would they be?
It sounds to me like the issue here arises more from an "everything is a nail" type of problem than anything else.