this post was submitted on 22 Jul 2023
679 points (98.6% liked)

Programmer Humor

19589 readers
746 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] mrmanager@lemmy.today 25 points 1 year ago* (last edited 1 year ago) (5 children)

I try to always rewrite complicated code. As an example, another dev who left the team had written a program in Elixir that nobody knew or understood. I rewrote it in python (with his help, since I still had contact with him over chat). After that, everyone in the team could understand the code and we could make changes very easily to it and document it.

Another program he wrote in python was kind of complicated and we would have bugs in it that we didn't know how to fix. So I rewrote it with a completely different architecture with focus on simplicity. And again, now everyone could just read the code and understand it.

I think many devs are writing code that is not simple to understand for others. Then rewriting it can be worth it to avoid the pain of trying to fix bugs in complicated code.

[–] Phoenix@programming.dev 7 points 1 year ago (1 children)

That's only the first stage. Once you get tired enough you start writing code that not even you can understand the next morning, but which you're loathe to change because "it just works".

[–] mrmanager@lemmy.today 7 points 1 year ago* (last edited 1 year ago) (1 children)

Yeah I've had that experience too. But sometimes I write a lot of hackish code to get it to work, and then after spend time rewriting it so it's easy to understand. But it depends on mood. Sometimes I don't change it because it's complicated and it would be too much thinking required to make it better. :)

Programmers are often lazy by nature...

[–] Phoenix@programming.dev 6 points 1 year ago (1 children)

Lazy is right. Spending fifty hours to automate a task that doesn't take even five minutes is commonplace.

It takes laziness to new, artful heights.

[–] Beanie@programming.dev 1 points 1 year ago

wouldn't doing significantly more work than necessary be the opposite of laziness?

load more comments (3 replies)