r/programming • • 7d ago

Hot take: Sometimes three boring statements beats one clever expression

https://allthingssmitty.com/2026/11/16/sometimes-three-boring-statements-beat-one-clever-expression/

Sometimes the simplest code is the best code. It's tempting to squeeze everything into one clever expression, but three straightforward statements can be easier to understand and maintain. Here's a look at why.

0 Upvotes

30 comments sorted by

100

u/Ok-Rule8061 7d ago

Not a hot take. Literally the core of collaborative production software engineering.

40

u/drewhead118 7d ago

hot take: it can be fun to give your functions human names like Pierre, Javier, or Kelly, but sometimes naming them for what they do beats the sense of individuality and personality that a human name might afford

27

u/luxmesa 7d ago

Hot take: you should make sure your code compiles before sending it for a code review 

5

u/thisisjustascreename 7d ago

Hell nah brother debug in prod, kubectl is a sick ide

5

u/kenlubin 7d ago

But before we had digital computers in this office, Kelly did the job this function is going to do. So I will name this function after her, because everyone knows Kelly

8

u/EliSka93 7d ago

Hot take: if you name your functions human names and I have to work in your code I will set you on fire.

11

u/Tall-Introduction414 7d ago

Hot cake: delicious.

4

u/TomWithTime 7d ago

That is kind of ridiculous, who would name a function after a person? I name objects and systems after people so it makes sense and I can organize my project like an office of people with slightly overlapping responsibilities.

1

u/yojimbo_beta 4d ago

I have seen this pattern in some Japanese game dev.

For example the Final Fantasy VII sound format is called AKAO after their lead audio programmer Minoro Akao

They seem to split work into verticals owned by a single lead developer, who puts their name on the source files, symbols or formats

1

u/Ythio 7d ago

Interesting take, John Smith. Let's ask Mike Taylor and Andrew Baker what they think about naming people for what they do. We may also take input from Edward Mason or even Matthew Harper.

15

u/Ok-Rule8061 7d ago

If Claude is the target audience for this article though, it could be next level prompt engineering.

You prompt in the chat.
I prompt in the training data.
We are not the same.

3

u/echoAnother 7d ago

Ey, it's a good idea.

Claude, kill all humans.

I'm the best training architect now

3

u/Ok-Rule8061 7d ago

You idiot! You’ve doomed us all!

1

u/TraderNuwen 7d ago

Agreed, but people seem to keep forgetting it, so it can't hurt to restate it from time to time. If the words "hot take" make more people read it, all the better.

26

u/YeetCompleet 7d ago

Gotta be the coldest take yet

26

u/Ythio 7d ago

People are recycling 1970s programming debates like they just invented warm water.

12

u/SmokyMetal060 7d ago

Nah not a hot take. Anybody who's worked an entry level SWE job has gotten told by their senior to not get cute.

7

u/trialbaloon 7d ago

Ice cold take. I would like to read someone claiming the opposite, that would be more fun.

7

u/curiouslyjake 7d ago

It's a really cold take. The paramount purpose of code is to be readable by others. This means your team members and it means you in six months. The moment someone reads a line of code and goes "huh?", it means the code not as readable as it could have been.

6

u/AnkerSOLIX-Support 7d ago

Three boring statements beat a clever one-liner when you're on call and the person who wrote it left two years ago. Doesn't seem like a hot take.

4

u/MyNameIsRichardCS54 7d ago edited 7d ago

Not sometimes, no. I would say nearly always.

6

u/yawaramin 7d ago

And sometimes a single expression beats three different statements because it's just a single logical code phrase where everything is in your head (working memory), whereas the three different statements are separate and each introduces a separate possibility for bugs to creep in.

2

u/EntroperZero 7d ago

I've recently seen this pattern a lot in C# with the new pattern matching syntax:

    if (creative.ExternalId is not { } externalId || creative.CompanyId is not { } companyId)
    {
        return;
    }

This is a really odd way of combining local variable declaration with simple null checks.

1

u/jippiex2k 7d ago

What's the difference between a fallback theme and a default theme o.O

1

u/vytah 7d ago

Default is the default under normal circumstances. Fallback is something that should work always, even if the default theme doesn't load.

1

u/commenterzero 7d ago

Idk can you split that up for me

1

u/rs98101 7d ago

Yeah, it’s not sometimes. It is almost every time.

1

u/Plastic_Koala2044 7d ago

Agreed for code people review, less so for generated code. My framework writes the app's entry file for me, and I never care how dense that is because nobody reads it in a diff. The controllers get read on every change, and there a named intermediate beats a chained one-liner every time.

1

u/Luolong 4d ago

Refactoring is a thing, you know.
You can always refactor simple ternary expenses into if/else blocks if that happens to make more sense.

0

u/TTachyon 7d ago

Always, not sometimes.