this post was submitted on 21 Mar 2024
2 points (100.0% liked)

Programmer Humor

19315 readers
5 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 1 year ago
MODERATORS
 
top 16 comments
sorted by: hot top controversial new old
[–] 9point6@lemmy.world 1 points 6 months ago (2 children)

Const everything by default

If you need to mutate it, you don't, you need to refactor.

[–] noli@programming.dev 2 points 6 months ago (1 children)

Dogmatic statements like this lead to bad, messy code. I'm a firm believer that you should use whatever style fits the problem most.

Although I agree most code would be better if people followed this dogma, sometimes mutability is just more clean/idiomatic/efficient/...

[–] Corbin@programming.dev -1 points 6 months ago

Define your terms before relying on platitudes. Mutability isn't cleaner if we want composition, particularly in the face of concurrency. Being idiomatic isn't good or bad, but patterned; not all patterns are universally desirable. The only one which stands up to scrutiny is efficiency, which leads to the cult of performance-at-all-costs if one is not thoughtful.

[–] Magnetar@feddit.de 0 points 6 months ago (1 children)

Scala user unite! There are dozens of us, dozens!

[–] crispy_kilt@feddit.de 0 points 6 months ago (1 children)

Scala? Can we reimplement it in Rust?

[–] Magnetar@feddit.de 0 points 6 months ago (1 children)

But does it do everything in anonymous functions and lambdas?

[–] crispy_kilt@feddit.de 0 points 6 months ago
[–] loxdogs@lemmy.world 1 points 6 months ago

can someone explain please?

[–] xmunk@sh.itjust.works 1 points 6 months ago

The only const in life is to const all the things.

[–] lemmesay@discuss.tchncs.de 0 points 6 months ago (1 children)

I oscillate between using more functional paradigms and more object-oriented ones. is that normal?
I use a linter BTW(TypeScript) if that is a useful info.

[–] crispy_kilt@feddit.de 0 points 6 months ago (1 children)

Avoid shared mutable state like the plague in any paradigm and you'll be fine

[–] lemmesay@discuss.tchncs.de 0 points 6 months ago (1 children)

state management crying in the corner

[–] crispy_kilt@feddit.de 0 points 6 months ago

Functional state management is fine

[–] crispy_kilt@feddit.de 0 points 6 months ago

Needs more monads

[–] ornery_chemist@mander.xyz 0 points 6 months ago (1 children)

you mean let.

and then letting Hindley-Milner do the rest

[–] Magnetar@feddit.de 0 points 6 months ago

let there = "light"