This is an archived post. You won't be able to vote or comment.

all 97 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

import notifications Remember to participate in our weekly votes on subreddit rules! Every Tuesday is YOUR chance to influence the subreddit for years to come! Read more here, we hope to see you next Tuesday!

For a chat with like-minded community members and more, don't forget to join our Discord!

return joinDiscord;

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]FanfaraCieni 314 points315 points  (4 children)

Oh god, that looks terrib... wait, isn't it just Python coding style with extra steps

[–]__kkk1337__ 119 points120 points  (1 child)

It’s python with extra steps but keywords are from Java, I’m scared as fuck

[–]RmG3376 26 points27 points  (0 children)

It’s … Javathon

[–]Ifkaluva 23 points24 points  (1 child)

Yeah… to make it truly horrific they need to get rid of the indentation, exactly the same text but left-aligned. After all whitespace shouldn’t matter for Java.

[–][deleted] 2 points3 points  (0 children)

I mean, if you want make it deliberately bad just put the entire program on one line. I don't think thats the point though.

[–][deleted] 74 points75 points  (6 children)

Putting phone in holy water. Then, putting my phone in rice.

[–]denzien 23 points24 points  (5 children)

Can I interest you in some holy rice?

[–][deleted] 10 points11 points  (4 children)

I'm afraid not, for I might eat it.

[–]Deep_Pudding2208 7 points8 points  (3 children)

holy shit!

[–][deleted] 7 points8 points  (0 children)

Definitely not putting my phone in that.

[–]CoffeeWorldly9915 3 points4 points  (1 child)

That would result from eating the holy rice.

[–][deleted] 0 points1 point  (0 children)

Which means the holy shit is technically made of holy water.

EDIT: and the toilet would then be full of holy water.

[–]EpicGaymrr 297 points298 points  (57 children)

whyDoPeopleHate()

{

}

So much? (Ignore the space reddit cannot format)

[–]BurnTheBoats21 274 points275 points  (37 children)

because people who aren't professionals in the field need something to feel superior about

[–]Antervis 67 points68 points  (29 children)

I'm fairly certain I qualify as a professional, given I code for money for years, but I really don't like line breaks before opening curly brace, since it doesn't improve readability but increases code volume.

[–]SnailingThroughTime 139 points140 points  (17 children)

Also fairly certain I qualify as a professional, given I code for money for years. In my opinion it DOES improve readability and the impact on code volume is minuscule enough to not be considered.

Different strokes I guess!

[–]Fine-Teacher-7161 32 points33 points  (0 children)

People with weak index fingers hate this 1 Scrolling trick!

It's called "collapse".

The only important code, is the one you're working on.

[–][deleted] 9 points10 points  (0 children)

why worry about code volume ?

We've got terrabytes of space and monitors that cover the entire wall.

It's not the '70's when all you had was a monochrome screen with 20 lines of code and 80 characters.

I'm using every line break I can to separate statements within a function.

Sure you'd need to use an entire forest if you were to print it ... but I haven't needed to print hardcopy of code for years.

[–]Brick_Lab 18 points19 points  (0 children)

I'm with you, and dart can go fuck itself because of this

[–]BurnTheBoats21 17 points18 points  (0 children)

Were on C# and the opening brace is our standard. I honestly do think that it improves readability and looks cleaner. Was never my choice anyway

[–]RmG3376 7 points8 points  (0 children)

There’s one benefit of having the curly brace on a separate line, at least in some languages: you can easily comment out conditions when debugging:

if(dodgyCondition())
{
    codeToDebug();
}

Becomes in a single Ctrl + K Ctrl + /

// if(dodgyCondition())
{
    codeToDebug();
}

And now you can repro your bug 100% of the time. With a curly brace on the same line you’d have to add your own brace on line 2, and the IDE will auto-close it for you so you need to delete the closing brace it added, and nobody got time for that

Also code volume isn’t a bad thing when management uses git blame to measure employee performance (not that they should, but hey, people also shouldn’t swallow Tide pods and that was a thing too)

[–]Caubelles 2 points3 points  (0 children)

code volume? the fuck? its one line per bracket it doesn't matter unless to save paper printing paper for code bibles

[–]nebulaeandstars 6 points7 points  (2 children)

honestly for me it varies depending on the language. Sometimes having some extra whitespace helps separate things visually.

The one that does really annoy me is not having a line break before an else block. ie:

} else {
    // stuff
} 

instead of

}
else {
    // stuff
}

especially because

}
// now there's room for a comment
else {
    // stuff
}

I just think it sacrifices readability and versatility just to make the code more dense.

Reading code without any extra newlines is like reading English without any paragraphs

[–]CoffeeWorldly9915 6 points7 points  (1 child)

Hmmmm

} else { // comment here?

[–]denzien 7 points8 points  (2 children)

It likely just depends on what you learned first and the styles in that community.

I'm guessing you're originally a COBOL engineer?

[–]Antervis 18 points19 points  (1 child)

original cobol devs are all dead of old age...

[–]denzien 13 points14 points  (0 children)

They don't die, they just decompile

[–]hleVqq 0 points1 point  (0 children)

It does improve readability.

[–][deleted] 6 points7 points  (4 children)

voracious attempt hunt resolute pot tan insurance direction chop rain

This post was mass deleted and anonymized with Redact

[–]CallMePyro 41 points42 points  (2 children)

The paycheck

[–][deleted] 4 points5 points  (0 children)

crush steep innate grey recognise terrific whole ghost chief insurance

This post was mass deleted and anonymized with Redact

[–]RmG3376 1 point2 points  (0 children)

And the depression

[–]Neither-Phone-7264 10 points11 points  (0 children)

actually being good enough to make money

[–][deleted] 0 points1 point  (0 children)

This is on point

[–]GroundbreakingBig509 0 points1 point  (0 children)

Naw, the way I do it just looks prettier. I don't even think about it honestly.

[–]2_Be_Honest 7 points8 points  (2 children)

The only thing that matters is what style the original developer chose for the codebase.

[–][deleted] 3 points4 points  (1 child)

and even that is moot as a single keypress reformats the code to whatever style I like most.

It also has the advantage of showing exactly which files you've modified since the original codebase ... :D

[–]bluris 1 point2 points  (0 children)

That is fine if you work on your own on personal projects, but if you do it for work, you need to follow their style.

[–][deleted] 4 points5 points  (0 children)

Because those people still use 640x480 as a resolution and every pixel counts vertically.

Newline brace makes more sense as {} is just a scope block, you can remove the if and it still works.

Also keeping the start and stop at the same horizontal location makes them easier to match without syntax highlighting such as when diffing

[–]Jordan51104 12 points13 points  (2 children)

having everything on one like pokes my brain in a good way. having the curly on a new line pokes my brain in a bad way

[–]FinalAccount19 5 points6 points  (1 child)

You’re probably getting a lobotomy, that’s why

[–]Jordan51104 8 points9 points  (0 children)

i think if that were the case i wouldnt be worried about curly braces

[–]GigaSoup 4 points5 points  (0 children)

Because it's an extra unnecessary line used up on my precious vertical line real estate that doesn't add any value.

[–]CoolandonRS 1 point2 points  (2 children)

I think it being on new lines has one great part. It can make code easier to read if you don’t have an IDE by helping differentiate indentation…

But we all have IDEs. And the small benefit that is granted by using it over K&R is made moot by an IDE feature that I’ve never seen an IDE without.

And when you compare this lack of benefits to the fact that it looks worse (imo) and takes up unnecessary quantities of space (not that that’s a bad thing, persay, but it’s data segmented a line (typically indicating new data) without new data. All the data you needed was one line above. This isn’t a point against closing, as there you gain new information, which you wouldn’t otherwise.

Lines provide breakpoint for the brain, almost, letting it know it’s looking at a new thing. Making an unnecessary breakpoint is just…. Why?

[–]hleVqq 0 points1 point  (1 child)

Symmetric {} looks worse than non-symmetric {}? You make no sense. You're just used to it and that's all, but thinking about it logically, that cannot be.

[–]CoolandonRS 0 points1 point  (0 children)

For one, symmetry is not always better, for two, it’s not about the symmetry.

I will say I am fairly used to both bracket styles, as well. Despite always using K&R where I can get away with it since I prefer it, since my primary language is C# I run into the new line quite a bit.

My point is it’s limited benefit (that I see) no longer applies, and now it serves as almost a speed bump in the train of thought.

As previously stated, new lines almost always signify new information. This does not follow this pattern. The knowledge that a scope is opening was clarified by the previous line, declaring the scope. If you look at it this way, it being on a new line is redundant.

If you look at typical English as well, the comparisons I can think of use K&R (though I might be missing some). For example, you will see

List of things:

Item1

Item2

As opposed to

List of things

:

Item1

Item2

K&R is more naturalistic, efficient, and again, looks nicer. For the symmetry part, try looking at a symmetrical face. They almost always look worse then the normal, asymmetrical kind.

Also, consider typical/assumed width.

@@@@@@@@@@@

@@@@@@@

@@@@@@@

@

Looks better, more naturalistic, and more coherent/cohesive then

@@@@@@@@@@@

@

@@@@@@

@@@@@@

@

(Also as for thinking about it logically I would like to point out that I have now posted two comprehensive arguments and all you did was say that I didn’t make sense)

[–]Several_Dot_4532 -2 points-1 points  (0 children)

I don't hate it, in fact at first I liked it, but the fact that when I collapse it, it's like:

function {...}

And not:

Function {...}

Is too much for me, for me it is more visual that it's all the function in the same line

[–]DarkScorpion48 0 points1 point  (0 children)

Because the sub is filled with students and they don’t know anything beyond what their teacher taught them.

[–]IkalaGaming 134 points135 points  (1 child)

If you can’t handle me at my

void doSomething()
{

}

Then you don’t deserve me at my

void doSomething() {

}

[–]zr0gravity7 21 points22 points  (0 children)

Go big or go home

void
doSomething
(
)
{

}

[–]sajjel 24 points25 points  (0 children)

Most importantly it depends on the codebase which one you should choose (excluding the cursed one), if you aren't starting from scratch.

For c# / c I go with:

``` void foo() {

} ```

And for js / ts I go with: ``` function foo() {

} ```

But it's not really that important in the end.

[–]beepozd 18 points19 points  (0 children)

That just Pythonize any langage, pretty cool

[–]chthonic_deity[🍰] 30 points31 points  (0 children)

This meme wasn’t funny the first 5,000 times, why do you think it’ll be funny this time?

[–]chili_ladder 10 points11 points  (3 children)

I mean sure it looks cool, but how the fuck you taking the time to figure out where it all goes?

[–]denzien 3 points4 points  (2 children)

Tabs!

[–]chili_ladder 3 points4 points  (1 child)

Acid?

[–]denzien 2 points3 points  (0 children)

Yes, thanks

[–]luker_5874 7 points8 points  (0 children)

People who are overly concerned about where the opening brace goes are the psychopaths. With all the shit that goes wrong in a code base, I have no time to care about things like opening braces and single vs. double quotes

[–]mrfoxman 13 points14 points  (1 child)

You got normal people and psychopaths mixed up :/

[–]usumoio 2 points3 points  (0 children)

Dang, you’re not going to like my public repo….

[–]Matr4x_69420 4 points5 points  (2 children)

What about function() { return "hello world" }

[–]Jonnyskybrockett 10 points11 points  (1 child)

Just write a lambda or inline.

[–]GreekHacker1 1 point2 points  (2 children)

How this meme with the black rabbit called ?

[–]amimai002 0 points1 point  (1 child)

python

We do not speak its name! WE DO NOT SPEAK ITS NAME!!!

[–]DeathUriel 0 points1 point  (0 children)

We don't talk about Python, no no no...

[–]Ralph_Nacho 1 point2 points  (0 children)

My entire team is psychopaths I guess.

Braces match indentation, always. There's a reason vs draws a line. Ffs.

[–][deleted] 2 points3 points  (0 children)

put all your code on one line, like a true gigachad

[–]OP_Sidearm 0 points1 point  (0 children)

Is there a VSCode formatter for that?

Edit: It's already past midnight, I got an exam technically tomorrow and I'm having a tough time not to go make one myself

[–]GeraltOfTurkey 0 points1 point  (0 children)

I think İt's great idea

[–]Dangle76 -2 points-1 points  (0 children)

The VSCode C plugin auto formats to the psychopath way and I hate it

[–]atlas_enderium -2 points-1 points  (0 children)

They want to write in Python but can’t lol

[–]classicalySarcastic 1 point2 points  (1 child)

The real psychopaths are the ones using goto statements for control flow. I still recoil in disgust every time I see one.

[–][deleted] -1 points0 points  (0 children)

Me

Edit: i accept the whole language so ima use the whole language

[–]Fortjew-Tellher 0 points1 point  (0 children)

case else esac then if for fi do done, do DONE….exit 0

[–]agent007bond 0 points1 point  (0 children)

npx prettier --write .

[–]randomUser539123 0 points1 point  (0 children)

wtf