this post was submitted on 10 Feb 2024
629 points (100.0% liked)

196

16476 readers
2147 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] blindsight@beehaw.org 54 points 9 months ago* (last edited 9 months ago) (3 children)

idk, Allman is very readable. Easy to scan vertically to find the matching open brace. Not quite as vertically-space efficient as the best way, but it's not offensive.

[–] I_am_10_squirrels@beehaw.org 33 points 9 months ago

Plus one for Allman gang

[–] hardware26@discuss.tchncs.de 8 points 9 months ago

In my first ever programming class textbook was using Allman. Probably for this reason, it is easy for a beginner to match braces. It is a lot loss common industry to my knowledge.

[–] rubythulhu@lemmy.blahaj.zone 6 points 9 months ago (1 children)

this is only true if you don’t indent properly

[–] blindsight@beehaw.org 6 points 9 months ago (1 children)

I literally don't understand. I've read your comment several times and I don't know what you're talking about. Sorry!

Did you think I was saying that made Allman better than the best way? Because it's easy to scan vertically the best way, too. It's just also easy with Allman, so it's not offensive.

[–] ubergeek77@lemmy.ubergeek77.chat 6 points 9 months ago

I don't think they were disagreeing with you, I think they were just trying to say:

You shouldn't need braces to be vertically aligned if your code is uniformly indented. Then you can easily see what code is paired together just by their indentation level.

Of course this is not always true if you've got a bunch of crazy nested indentation pushing things off to the right.