r/ProgrammerHumor • • Sep 23 '22

Refactoring "Just working solution ".

Post image
54.8k Upvotes

355 comments sorted by

View all comments

Show parent comments

15

u/burnalicious111 Sep 23 '22

Short does not mean readable. Common point of confusion.

You can shorten by simplifying, which does help with readability. But you can also shorten by making more implicit instead of explicit, and that hurts readability (which the writer often forgets in the moment, because in that moment the implicit is perfectly clear to them. For now.)

6

u/vadiks2003 Sep 23 '22

i know that moment haha, pythonists make the worst one liners ever to exist. i thought shortening stuff helps because the bigger the stuff looks, the harder it is to remember relations between things and the more it looks overwhelming, atleast for me

6

u/burnalicious111 Sep 23 '22

because the bigger the stuff looks, the harder it is to remember relations between things and the more it looks overwhelming, atleast for me

This tends to improve as you gain expertise, because your brain learns relevant patterns, which it can use to chunk and store the information more efficiently.

But even then, that's still about optimizing for your working memory to remember all the moving parts, and not about optimizing how easy it is to understand how it works. The former is only a part of the latter.

1

u/Meefbo Sep 24 '22

But sometimes implicitly and short is the way to go for readability. Look at some Java:

Thing bla = new Thing();

Soooo much is done there behind the covers, but it stays the most readable because I couldn’t care less what’s going on back there. Pointers? Malloc? I don’t care, just give me a funky chunk o’ memory and do it right.

Simplifying code has gotta be one of the most nebulous and difficult to describe things.