Dumb, readable code is infinitely better than clever: Coding horrors (digma.ai)
from LadyLeeLoosh@programming.dev to programming@programming.dev on 29 Nov 2023 14:03
https://programming.dev/post/6563737

CODEBASE COMPLEXITY: LESSONS LEARNED Dumb, readable code is infinitely better than clever.

Don’t listen to vendors blaming the hardware and recommending expensive server upgrades.

Be aware of the danger of shortcuts and the importance of understanding how code works under the hood.

Opening and closing a database connection is a slow and expensive operation.

Consider the potential risks and implications when installing new npm modules or importing someone else’s code.

Beware of teammates who refactor code based on personal taste without proper documentation or completeness.

Ensure code changes are well-documented.

Be cautious of colleagues who make undocumented changes that create subtle traps for others.

Improve the code review processes to address flaws.

Acknowledge that even big companies like Facebook can make mistakes, as seen in their DNS record issue on October 4, 2021.

Don’t ever be the guy who accidentally breaks something on prod.

Broken code is fixable. People, now, that’s another story.

#programming

threaded - newest

Valmond@lemmy.mindoki.com on 29 Nov 2023 14:35 next collapse

Some genius programmer made a totally new shine kernel for the scientific app we had, using template metaprogramming. I had to finalise it. I still nightmare about the errors (GCC 4.8).

If you think C++ is easy, then this is a simple trick to bump up the challenge IMO.

Also completely unmaintainable or expandable ofc!

LadyLeeLoosh@programming.dev on 29 Nov 2023 15:15 collapse

“There are only two kinds of programming languages: the ones people complain about and the ones nobody uses.” This is a famous quote attributed to Bjarne Stroustrup, the creator of C++.

Valmond@lemmy.mindoki.com on 29 Nov 2023 17:12 next collapse

Well, technically I didn’t complain about a programming language, but an abuse of it.

I like C/C++ !

LadyLeeLoosh@programming.dev on 30 Nov 2023 08:09 collapse

Me too:)

leggettc18@programming.dev on 01 Dec 2023 03:47 collapse

Same here, might just be because I learned with Object Oriented languages but C++ syntax just gels well with how I think. That could just be autism though.

WitchHazel@lemmygrad.ml on 01 Dec 2023 07:25 collapse

I dunno if it’s autism since I despise C++ lmao

WitchHazel@lemmygrad.ml on 01 Dec 2023 07:20 collapse

I don’t use C++ and I complain about it all the time. Never have I had a project that couldn’t be completed in equal or better accuracy in something other than C++, and the amount of development time it adds on just to use the damn thing is prohibitive. Let alone fast compilation for iterative design, or reduction in boilerplate. I feel the only thing C++ has is seniority and a smidgen of performance, and performance is rapidly being approached or exceeded by projects like rust.

I think there are two types of programming languages:

Good ones that are expressive and readable, like you need from a language.

And

Things that sorely need replacement.

Sorry, I just really fucking hate that quote. It’s so pretentious and stupid, and doesn’t allow for the development of anything new unless people don’t like it. Programmers are surprisingly conservative.

YurkshireLad@lemmy.ca on 29 Nov 2023 15:01 next collapse

A very recent university graduate joined our company many years ago. He was quite the C++ wizard, whereas we were slowly migrating from VAX Pascal to C++. No one could understand the code he wrote as he was using all kinds of jiggery pokery without comments. We had to ask him to simplify and comment his code! 😁

That doesn’t say much about us at the time!!

LadyLeeLoosh@programming.dev on 29 Nov 2023 15:14 next collapse

Sounds familiar

litchralee@sh.itjust.works on 29 Nov 2023 16:27 next collapse

jiggery pokery

+1 just because I love seeing this phrase in the wild

without comments

Oof

onlinepersona@programming.dev on 29 Nov 2023 17:44 collapse

Probably enjoyed templates too much.

Bro, did you know that templates are turing complete? You can write the entire program and run it in the compiler itself!

Semi-Hemi-Demigod@kbin.social on 29 Nov 2023 15:49 collapse

Opening and closing a database connection is a slow and expensive operation.

That depends a lot on your RDBMS and its configuration. For example, MariaDB can use a pool of connection threads so opening one doesn't take a lot of time.