393
you are viewing a single comment's thread
view the rest of the comments
[-] masterspace@lemmy.ca 4 points 6 months ago* (last edited 6 months ago)

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.

[-] CapeWearingAeroplane@sopuli.xyz 2 points 6 months ago

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.

this post was submitted on 30 May 2024
393 points (94.6% liked)

Programmer Humor

32601 readers
163 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS