this post was submitted on 24 Feb 2026
619 points (97.7% liked)
Programmer Humor
30112 readers
479 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Is there any real reason why most progranming languages look more like the 3rd panel and not like the 1st panel? There's gotta be a reason for all the nesting and indents that has nothing to do with readability since that shit makes it harder to read.
Because the 3rd panel looks better when you have dozens of physical properties to track. It also makes retrieval easier because you can get all the physical properties at once, instead of having to read every line.
For an example that small it doesn't matter, but for something larger it could become a performance benefit.
I would guess that it has to do with making it easier to parse. The indents won't matter very much, but the parser sees "physical = " and knows that a property named physical is being defined. What is the value of that property? Well, there's a "{", so the value is an object. And the value of that object is everything up until the matching "}". If you have a structure more like panel 1, then it's harder for the parser to know when the value of orange.physical is complete. There might be a [orange.physical.texture] section somewhere, for example.
It makes it harder to read the individual lines, but makes it easier to read them as a group, so you won't have to read as many lines on your day to day.
Once you’re used to it, indentation makes code soooooooo much easier to read. When I was in school and a classmate asked me for help with their code, I outright refused to touch it until they properly indented it. It makes it easy to see the structure.
For programming languages that make use of
{}, the reason is (almost always) scope.Take for instance this:
compared to this:
The intent of the first one is unclear. In the second one it's clear you should loop
do_thing()and then rundo_other_thing()afterwards. The indentation is only for readability in the above though. Logically there would be no difference in writingLanguages that use indentation and line breaks for scope look more similar to this:
A good way to feel that for yourself is by programming a little program in Assembly and C.
Make sure the program needs to loop a bit and perhaps also require some
if/elselogic.A simple one would be to read a 1000 integers and return the sum.
In C, you would do something like:
In assembly, you would go (writing pseudo, because I have forgotten most assembly stuff):
I also realised that you could just try using C with
gotoinstead of any loops and would realise similar things, but I'm not in the mood to rewrite my comment.In conclusion, it is easier to understand something like BASIC, if you haven't been introduced to other languages, but these
{}structures end up making it easier to catch control flows at a glance.That's also the argument I use when telling people to have opening and closing brackets of the same level at the same indent, while people prefer stuff like: