this post was submitted on 28 Feb 2025
945 points (99.4% liked)

Programmer Humor

21896 readers
2865 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] Zagorath@aussie.zone 58 points 3 weeks ago (3 children)

Nothing wrong with classes in functional programming though. Just return a new instance of the class from your method, rather than mutating an existing instance.

[–] frezik@midwest.social 24 points 3 weeks ago* (last edited 3 weeks ago)

Right, I think the two aren't as different as they appear. You can think of a closure as an object with just one method.

If OO programming is fundamentally about objects sending messages to each other, then there are many ways to approach that. Some of those ways are totally compatible with functional programming.

The legacy of C++ has dominated what OOP is "supposed" to be, but it doesn't have to work like that.

[–] xmunk@sh.itjust.works 15 points 3 weeks ago (2 children)

Javascript:

I heard you like mutating class data so I'm mutating the data you can put in your class data, dawg.

[–] underisk@lemmy.ml 7 points 3 weeks ago

JavaScript: a language for mutants.

[–] Zagorath@aussie.zone 3 points 3 weeks ago

To be fair to JavaScript (I feel gross just saying that), it does have the ability to do some more functional-like programming as well. For example, many of its more recent array methods like filter, map, and reduce are pure functions.

[–] amon@lemmy.world 3 points 3 weeks ago

Classes are just another way to define an object. Heck even Lisp has objects!