Which one is the superior one Jow Forums?

which one is the superior one Jow Forums?

Attached: brace style.png (655x318, 24K)

Top, but without the spaces

the first one desu
in b4 python

Allman for readability.

K&R if you need to squeeze out all the white space for some god damn reason.

Top is what I use

1TBP

why cant one include curly brackets into first and second line?

while (x === y) {
something();
somethingelse();
}

Allman is way more readable

i'm more used to the first style so that's more readable to me

t. Websoy

>have a long function name
>have to scroll all the way to the right to read where the brackets are

>have to debug and want to isolate some groups
>have to read from the right side with no uniform on where start of the brackets are

Attached: pike style.png (681x652, 25K)

for you

you have a serious autism if you name a function the way that you have to scroll to the right to fully read it

while x == y:
something()
something_else()

I can see that you've never worked with larger projects.

imfuckingretarded = true
while (imfuckingretarded === true)
{
console.log("I'm so fucking stupid for putting that bracket there, i think i have downs syndrome.)
}

K&R
Only brainlets waste space to make code look 'pretty'. Autists. It looks prettier on the same line, anyone who likes Allman is literally retarded.

These. Keeping track of brackets is objectively easier with the second one because they're aligned on the left.

there's no excuse for function names that long with proper use of structs/classes/namespaces

pretty much this
also the curly braces are not part of the if/while/function-constructions
they just collect several lines of code into a single block, and that single block is what gets tied to the function/if/while
same reason that without the curly braces you only tie the very next line to the if.

so in short you give the false impression that the curly braces are somehow part of the function/if/while by placing the opening one immediately to the right of the keyword

Attached: e808eda187032dbbf39d9f3f0a785f92.jpg (525x700, 67K)

>have a long function name
lrn2code

>Keeping track of brackets
>his TE or DE doesn't do this
lrn2code

'goto matching bracket ' will bring you to the function name line

In any large projects, you need readability over saving whitelines. Class names, struct names, namespaces must all be clear as day for whoever will be working on the project in the future. The fact that you don't know this shows your true color. Function names/class names/etc can be however long you want if it helps clears up the rational for that name. Its not just your own presupposition at work, you must also consider others working at the code.

>you give the false impression
lolwut

how fucking autistic are you if you think 1 line of whitespace will do anything for "reading plenty lines of code".

{ on new line ofc.

yes, a lot of people will read { as they do the colon after such keywords in Python
while it is in fact a separate construct to create a block of code

>Python
you have to be 18+ to post

it's personal preference you fucking spergs, the code is perfectly readable in both manners.

Also kinda related to OP: do you use brackets for one liner ifs/loops or not?

>>have to scroll all the way to the right to read where the brackets are
are you retarded? the position of the bracket is known implicitly
the next line after the function name is the function block

also you're fucking retarded if your function name is that long

If its 1 liner, you just combine it up within 1 line.

if (x) then { xyz; }

vs

if (x)
xyz;

myObj.holy_shit_this_method_name_is_so_long_I_have_to_scroll_to_be_able_to_read_it_all_yes_this_is_very_professional_did_it_hit_the_horizontal_limit_yet_guess_not_better_add_more_words()

Yes, that's how big projects work.

>resorts to strawman

Gooddu jobbu.

func thisFunctionDoesTheFollowingThingsOKFirstItInitializesTheReturnValueThen...()

also how small is your screen lmao

while (x() == y()) { something(*x()); somethingElse(&y()); }

Always been more of a K&R guy, decided to try Allman for my last project and I don't hate it. With K&R I often find myself placing blank lines for better readability or comments anyways.

so since you cleary get triggered with some blind autistic ragefit at the first word you read that reminds you of something you hate I guess I should clarify:
A lot of people will read a { right next to a keyword as if it is part of the construct of that keyword
...the same way a lot of people who use python and see a colon right next to the keyword read the colon as "ok the contents of the starts below this"

Post one example of function name so long you can't read it all in your screen or no argument to be found.

>A lot of people
[citation needed]

doesn't work well if both condition and statement happen to be fairly long

I use the K&R style, but I don't really give a fuck what other people use. The only thing that triggers my autism is when a project has mixed styles.

while ( x == y )
{ // Allman is better because comments fit snugly here!
something ( );
somethingelse ( );
}


while ( x == y ) // Oh shit nigger what are you doing!?
{
something ( );
somethingelse ( );
}

>mixed styles.
Go doesn't have this problem

while ( x == y ) {
// Allman is better because comments fit snugly here!
something ( );
somethingelse ( );
}

>readability
long class names may be descriptive but that aren't readable
good class names are short AND descriptive
if you have common classes called things like AbstractFactoryBeanProductionInitializer you should spend more time thinking about your code

brains just work that way
stuff that appears together over time unconsciously gets associated as belonging together

>the position of the bracket is known implicitly
braces are not mandatory and whitespace does not matter so you can not really just assume that it is there

Reminder if you use Allman, your program has been touched by the gay.

Attached: almonds.png (1040x184, 22K)

Top one obviously

New line brackets for functions
In line brackets for conditional statements

Attached: Pac Doge.png (768x1129, 307K)

how can a program be gay

>brains just work that way
so now your a neuroscientist too. cool.

>use top for all my life
>workplace demands bottom

Attached: 1530477582246.png (451x443, 300K)

I have never seen any actual argument that supports placing it immediately to the right except "it saves a line of code" (as well as personal preference, but that argument goes for every other format as well)

meanwhile there are several arguments for the aligned style presented in this thread (the only counter the proponents of the former style have is to REEEEE and strawman and use rude names at the proponents of the latter)

>it saves a line of code
thats the only argument you need

Why not both? Why do you guys care?

>workplace uses while(x==y){ with no spaces in between.

bottom

so why do you not use this style instead?
if (a == b && c == d)
{e = do_stuff(a, b);
f = do_stuff2(b, c);
g = do_stuff3(c, d);}

you save a whopping two lines of code and you did not even have to place two expressions on the same line

Attached: 1535035828282.jpg (960x800, 65K)

picture of vomiting anime girl

ask rust devs

>console.log

No, you're retarded for some other reason. Probably the Jabbershit.

while(x==y){
something();
somethingelse();
}

what if we aligned brackets on the right?

only proper way to do it
white space is for morons

armada's switch to commentary is going to be weird isn't it

while(x==y) { something(); somethingelse(); }


Fuck white space. Fuck readability.

>while(your_Mum===slut_){EAT.myFucking_ASS();DumbNigger_()}

Js is for faggots

You are not a real developer

I've configured vim to make everything GNU style.

I used to be an Allman guy but after using K&R for a while it tends to make code a lot more readable.

auto something = do_a_thing([&x, &y](int a, const std::string& b)
{
return [&](std::regex r)
{
// I have no clue what this lambda should do.
};
});
takes up too much space

while (x == y)
{ something();
somethingelse(); }

>waste space
yes, if you give too many newline characters to the compiler it will just give up and die

while (x == y)
{
something();
somethingelse();
}

while(x==y){something();somethingelse();}
If you're going to go that route, at least do it right.

i put a newline between each symbol just to ensure maximum readability
while
(
x
==
y
)
{
something
(
)
;
somethingelse
(
)
;
}

while(x==y)
{something();
somethingelse();}

What is with these autists complain about Allman "taking up too much space"? Are you all using 640x360 monitors or something?

while (x === y) {something(); somethingelse();}

Attached: 1535421942936.gif (480x270, 2.79M)

>some guy
while
{
code
}

>literally everyone who's important
while {
code
}

this man knows how to program like a professional

first one for conditionals, second for functions

I use Allman with the BSD-style 8 space indent, but it can become irritating if you have lots of nested blocks. Of course, some say you should just re-work your code if that happens, but sometimes it doesn't make sense to move five lines of code into a separate function.

Couple that with editors that want line length somewhere around 80, and sometimes the combination gets hard to read.

while(poo = loo {
DoShit();}

You were almost right.

I think K&R is more readable.

Newline for classes & functions, same line for conditional operators.

k&r, of course

Same. Dont believe those K&R

always use brackets, even for one-liners.

>A lot of people will read a { right next to a keyword as if it is part of the construct of that keyword
are these people programmers, or laypeople? cuz if they're programmers, they should know what the fuck a "{" is and what it's used for.

dude, get rid of that whitespace between your method name and the parens. it's making me crazy haha

Alan Turing, the father of crypto and CS also gay dumbass. Thats like saying if you like computer, you also a gayman. KYS.

as if the only people who send hate mail are people who hate gays. what a dork

Faggot code.

because we're not fucking retarded. d'uh!

please define "real developer"

it is. it's much easier to read, that's just how eyes work.
every time you see someone write it the Allman way, the rest of their code always looks like garbage.

and compilers are the only things that have to look at the code? never a programmer who might want as much code on his/her screen as possible? ........ok