231
submitted 1 month ago by TehBamski@lemmy.world to c/asklemmy@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] FiskFisk33@startrek.website 17 points 1 month ago

Ya'll think you have real unsolved problems. I'm here with "naming variables" (โŒโ– _โ– ).

[-] xJREB@lemmy.world 16 points 1 month ago

As a software engineering researcher, I strongly agree. SE research has studied code comprehension for more than 40 years, but for that amount of time, we know surprisingly little about what makes really high-quality code. We are decent in saying what makes very bad code, though, but beyond extreme cases, it's hard to come to fairly general statements.

[-] SandbagTiara2816@lemmy.dbzer0.com 2 points 1 month ago

Genuinely curious - what do we know makes code very bad?

[-] xJREB@lemmy.world 3 points 1 month ago

A few bad things in code for which we have fairly consistent evidence:

  • high nesting depth
  • meaningless or single-letter variable names
  • lots of code duplication
  • very inconsistent formatting
  • very complicated Boolean conditions with AND and OR
  • functions with a lot of parameters
[-] sparkle@lemm.ee 4 points 1 month ago* (last edited 1 month ago)

we become programmers because we lack creativity. my brain short circuits when i have to come up with something other than "foo", "bar", or maybe even "baz"

[-] holgersson@lemm.ee 8 points 1 month ago

Programming is quite literally creative problem solving, so I doubt that programmers lack creativity.

[-] sparkle@lemm.ee 5 points 1 month ago* (last edited 1 month ago)

Problem solving, of course, but creative writing, composition, and art... not my cup of tea.

[-] Passerby6497@lemmy.world 2 points 1 month ago

I have the opposite problem, my variables are sometimes too descriptive. I even annoy myself at times with VariableThatDoesThisOneThing and VariableThatDoesDifferentThing just because I want to be able to come back later and not wonder what I was smoking.

this post was submitted on 12 May 2024
231 points (99.1% liked)

Asklemmy

42523 readers
825 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy ๐Ÿ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~

founded 5 years ago
MODERATORS