16
you are viewing a single comment's thread
view the rest of the comments
[-] Olap@lemmy.world 10 points 1 year ago* (last edited 1 year ago)

I keep telling noobs that writing code is like 10% of what they do, and each line of code is a millstone round their neck. Terse, optimal performance (not optimized!) code meeting user requirements is the route to success. And so, doing less is how to go faster, but not what the video means

[-] Kolanaki@yiffit.net 2 points 1 year ago* (last edited 1 year ago)

Now, I am just a modder and not a full blown dev or anything, but I've always questioned others who critcized my scripts and suggested much more complicated ways of doing the same thing. Like I can do exactly what I wanted with 1 line of code, and someone would come in and say "do it this way for better results" and it's 6 lines of crap that ends up working exactly the same. Why?! Especially when this was for a game that has a notoriously slow script engine, meaning more lines of code = slower, no matter what you were doing.

[-] Tamo@programming.dev 7 points 1 year ago

Generally the performance difference will be minimal, but the benefit to others (and yourself in the future) in keeping the code's functionality clear and readable is much more important, especially in a professional setting.

A lot of programmers do have this 'code golf' mentality that less lines == efficient, but unless its a bottleneck and you've benchmarked it to be significantly faster, code readability should always trump performance.

[-] douglasg14b@programming.dev 2 points 1 year ago* (last edited 1 year ago)

Hard agree.

Less code is not a positive metric to measure your implementation by, and is not a valid premise to justify itself. Often increasing the complexity (again, LOC is not an indicator of complexity), tanking performance, and harming the debugging experience is a common result of the mentality. Things that make software worse.

Not all one-liners are bad ofc, that's not the argument I'm making. It's about the mentality that less code is more good, where poor decisions are made on a flawed premise.

load more comments (4 replies)
load more comments (8 replies)
this post was submitted on 03 Jul 2023
16 points (90.0% liked)

Programming

17074 readers
290 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS