[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vr / w / wg] [i / ic] [r9k] [s4s] [vip] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Home]
Board
Settings Home
/g/ - Technology



Thread archived.
You cannot reply anymore.



File: image.png (6 KB, 330x165)
6 KB
6 KB PNG
What Kind Of Programmer Are You?
>>
Whenever I see right, I know they're a virgin.
>>
1st
>>
i never indent.
>>
Everything in one line.
>>
if (condition)
foo();
else
bar();

>>
>>61885313
 
if()
foo();
else
bar();
>>
1st. All my professors are 2nd, though... Why is that?
>>
>>61885313
I never use newlines.
>>
>>61885362
Are your professors by any chance Indian?
>>
>>61885313
I use the left one, but with spaces between the functions, like a proper human being.
>>
>>61885383
poo();
>>
>>61885313
I use both randomly

t. madman
>>
>>61885416

loo(poo);
>>
>>61885329
extremely patrician man
>>
>>61885383
Brazilian. They're all decrepit old man.
>>
the first is understandable in an autistic way, but the second is objectively superior because it's honestly just insane to use that many lines purely for solitary braces

if you have a problem with this, that's fine, but you'll have to accept that no rational human bean will ever agree with you
>>
>>61885434
Poo.init();
>>
>>61885329
kys
>>
File: IMG_20170810_201219.jpg (78 KB, 1280x1280)
78 KB
78 KB JPG
>when he doesn't exclusively use ruby
r0tf
>>
>>61885458
>it's honestly just insane to use that many lines purely for solitary braces
so why is the second superior?
>>
I mostly use the left style, but when I need to print my code I use the right style.
>>
>>61885487
why would need to print your code?
>>
>>61885313
foo() if condition else bar()
>>
>>61885313
I follow the fucking best practices of the language like any other non-NEET
>>
>>61885313
condition ? foo : bar
>>
>>61885434
while (!loo) { poo(); };
>>
if (condition) 
foo();
else
bar();


if(condition) {
foo();
anotherFoo();
} else {
bar();
anotherBar();
}
>>
>>61885487
Shit I meant the reverse.

>>61885496
I mostly print my code in order to find bugs while on the train.
>>
>>61885352
>
if (condition)
foo();

Fucking lawlessness. Might as well program in Python. Always curly braces, we have rules as a society for a reason. We are in the end times.
>>
File: real_programmers.png (83 KB, 740x406)
83 KB
83 KB PNG
>>61885313
A -real- programmer.
>>
>>61885313

The kind that just runs an indenter tool like indent or astyle.
>>
>>61885352
 condition ? foo() : bar();
>>
>>61885609
>>61885522
took you long enough.

ternary master race reporting in.
>>
>>61885522
>>61885609
ternary is lazy hieroglyphic bullshit
>>
>>61885609
condition 
? foo()
: bar()
>>
>>61885631
>hieroglyphic
that's why you use it on select cases, faggot.
>>
>>61885313
What's with your currynigger blog title caps?
>>
File: 1111.jpg (32 KB, 330x197)
32 KB
32 KB JPG
>>61885654
lol ok tutankhamun
>>
>>61885313
left

>>61885352
goto fail;
goto fail;
>>
>>61885313
A shitty one.
>>
>>61885688
That's why you always auto-format the code, they were stupid
>>
How do you faggots read the left one? The right looks so much more comfy.
>>
>>61885688
>using goto
Who's the real failure here?
>>
The right one.
>>
>>61885742
if (condition) {

foo();

} else {

bar();

}
>>
>>61885748
>pretending that goto doesn't exist by coating it in syntactic sugar
>>
>>61885748
if (((condition)))
fail();
fail();
>>
foo if condition
bar unless condition
>>
>>61885748
>falling for the goto is shit meme

Just throw an exception amiright
>>
best place to learn programming:
https://painlessprogramming.blogspot.hr/
>>
>>61885313
type
func()
{
if (condition) {
foo();
} else {
bar();
}

return(val);
}
>>
>>61885802
>exception
>not doing this:
okay: do {
fail: do {
/* code */
if (err_cond) {
break fail;
}
break okay;
} while (false);
/* Error handler here */
} while (false);
/* Other code */
>>
>>61885313
Left the virgin if statement.

Right the chad if statement.
>>
Only right way.

if (condition)              {
foo() ;}
else {
bar() ;
}
>>
Here's the superior way
if(condition)
{foo();}
else
{bar();}
>>
File: 1.jpg (59 KB, 400x589)
59 KB
59 KB JPG
>>61885961
>
{foo();}

looks like sideways Carmen Miranda winking
>>
if(condition) {foo();}
else {bar();}
>>
>>61885783
superfluous call to a second fail()

It's clear that fail() returns >>You
>>
>>61885487
my 50+ year old teacher told me he did that "back in the day"
>>
>>61885313
I use the second cause I find it easier to read at a glance
>>
>>61885313
Right because GNU style is best style.
>>
>>61886169
die

left because the right side is being hit by cars in charlottesville
>>
>>61885980
DELET THIS
>>
>>61886169
Except it's not GNU, it's Allman
>>
File: d20.jpg (20 KB, 420x420)
20 KB
20 KB JPG
if (condition) then foo()
else
begin
bar()
end;
>>
>>61885313
if (condition) foo();
>>
>>61886124
It's clear that you didn't get the reference in >>61885688
>>
>>61885313
the kind that calls you a fucking faggot on a shitty image board
>>
>>61885319
This.
>>
>>61885933
if (condition)                    {
foo() ;}
else {
bar() ;
}
>>
>>61885748
Apple obviously
>>
>>61885609
(condition ? foo : bar)();
>>
go fmt
>>
>} else {
this line is fucking embarrassing. left side is shit. Allman style > *
>>
>>61885760
if (condition)
{
foo();
} else
{
bar();
}
>>
>>61885319
>implying stallman doesn't get all the pussy
>>
>>61885313
Refactor to use polymorphism.
>>
if (condition) {foo();} else {bar();}
>>
>>61885577
You should use a flashlight and a can of pesticide for that, Milton.

>>61885777
Trips of troofs

>>61886186
antifaggot = soros = neoliberal = center-right.
>>
>>61885313
void
main(void)
{
if (condition) {
foo()
} else {
bar()
}
}
>>
>>61885313
I prefer
if condition then
foo ()
else
bar ()

Ocaml master race.
>>
>>61893229
Forgot the ;
>>
140 if condition=1 then gosub 1500 else gosub 2000
>>
>>61885646
Are you out of your god damned mind?
>>
>>61885313
Seeing code with the right form makes me wanna gouge my eyes, holy shit, it's tiresome reading 10k+ lines of code all in that format even worse when they start nesting shit, fuck anyone who uses this shit.

Thank god for auto-format becoming more and more popular and efficient, i can just click a button to clean all this bullshit.

if (condition)
{
if (condition)
{
if (condition)
{
if (condition)
{
foo ();
}
}
else
{
if (condition)
{
foo1 ();
}
}
}
else
{
foo2 ();
}
}
else
{
bar ();
}


This shit makes my blood boil, holy shit.
>>
>>61885313

if (condition) {
foo();
}
else {
bar();
}
>>
>>61885313
I mostly stick to official doc of the language so everyone who review my code can't bitch at me for writing unorthodox shit.
If it's not my own project, I follow the rules already set.
There is no reason to throw at everyone faces my preferences, being readable is more important than feeling different or whatever.
>>
>>61885313
i usually just do this and get paid for having a vagina.

if (a < b && b > a):
>>
>>61893323
this is what I do desu, pls no bully
>>
>>61893412

The Stroustrup method produces clean code. Ironically, the opposite of his language.
>>
>>61885600
wow, never realized butthurt nanofags made those comics
>>
left, always.
>>
>>61890896
i like it
Is it possible to do that in haskell?
>>
if blah
foo()
else
bar()

>curly braces
>2017
reallynow.jpg
>>
I love this syntax but It makes me sad that my company doesn't use it.

if (condition)
{ foo(); } //one line
else
{
//multi-line
bar1();
bar2();
}


My general rule of thumb is that curly braces should always be on the same line or in the same column.
>>
>>61885313
right one
>>
>>61893323
This.
>>
File: 1385922039966.png (431 KB, 640x478)
431 KB
431 KB PNG
>>61886036
>>
>>61885424
my man
>>
>>61893571
Both of these are disgusting and you should feel ashamed
>>
>>61885313
Left is literally how you spot shitty newbie programmers who are trying to appear smarter or "witty" or some bullshit. In reality it just makes the code unreadable.
>>
One that actually makes money occasionally writing spaghetti code that works in only half a second longer. Suck my dick loser nerds.
>>
>>61893271
kek
>>
>>61885313
Depends on the styling guidelines of the project or language.
>>
>>61885313
Honestly if it's that simple i usually dont bother at all

if (cond){foo();} else {bar();}
>>
>>61885313
fn for_loop() {
for x in 1..11 {
if x == 3 { continue; }
if x == 8 { break; }
println!("x = {}", x);
}
>>
File: 1442883487194.jpg (103 KB, 528x544)
103 KB
103 KB JPG
var actions = new Dictionary<Boolean,Action>();

actions[cond1] = foo;
actions[cond2] = bar;

actions[expression].Invoke();
>>
for some reason at my uni, everyone uses

if (something) {
nigger();
}
else {
whatver();
}


its kinda annoying
>>
>>61885313
if (condition) {
x();
}
else {
y();
}
>>
if(a<b && b>a && !(a>b) && !(b<a) && a!=b && b!=a && !(a==b) && !(b==a))
{foo() ; } else
{ bar();}
>>
>>61894669

I don't mind that style. It's pretty easy on the eye.
>>
>>61885609
but with java you can only use ternary's to return values, not run functions that don't return to a value.

Based Poos
>>
K&R and Block style are the least shit on my eyes.
>>
>>61885319
Whenever I see left, I know they're still waiting for their loo installer
>>
>>61893306
>reading 10k+ lines of code
found your problem. you're a code monkey
>>
(if condition
(foo)
(bar))
>>
>>61885313

if condition {
foo()
}
else {
bar()
}
>>
>>61894669
Protip: you're the annoying one
>>
>>61885362
>1st. All my professors are 2nd, though... Why is that?
Have any of them had a real job, perhaps that's why.
>>
>>61885313

Right one. Whitespace isn't a limited resource.
>>
>>61885313
Right. The brackets lined in the same column please my ocd.
>>
>>61885424
That.

Note, at work, right is used.
t. Vidya code monkey
>>
>>61893571
I just fell in love, thank you anon
>>
>>61885313
Left before this thread, now I'm right
>>
if (condition){foo();}
else{bar();}
>>
>>61894228
this
>>
>>61893306
>if (condition){
> if (condition){
> if (condition){
> if (condition){
> foo ();
> }
> }
> else
> {
> if (condition){
> foo1 ();
> }
> }
> }
> else{
> foo2 ();
> }
>}
>else{
> bar ();
>}
>>
>>61894669
its because its a uni. theyre all retarded
>>
>>61885313
condition ? foo() : bar();
>>
>>61885313
If you put an else and if's closing bracket on the same line, you shouldn't be allowed to code.

>>61898852
>anon visits /tv/
>>
>>61894565
fuck you
>>
>>61894736
fuck you its:
bar();
>>
if (condition) {
foo()
return;
}
bar();
>>
bar();
if(condition)
foo();
>>
File: 1502371185950.jpg (39 KB, 329x623)
39 KB
39 KB JPG
>>61885313
I used to code like the second programming until my Java professor recommend me to do the first, now I can easily read my own code without headaches.
>>
>>61893558
Idk I do it in js and f#
>>
IT'S A "ANOTHER POINTLESS THREAD"
>>
if condition {foo()}
else {bar()}
>>
>>61885646
That's pretty nice, I'll use this from now on.
>>
>>61893323
I do this too. It's shame that most autoformatter format else to be where the if block ends. Usually just use the autoformatter way to get unified code style across code base.
>>
int main(int argc, char **argv)
{
if (argc)
{
foo();
}
else
{
bar();
}
}
>>
>>61893323
Undoubtedly better than
} else {
but suboptimal.
>>
int main(int argc, char **argv)
{
if (argc) {
foo();
}
else {
bar();
}
}
>>
>>61885313
Allman style or GTFO
>>
Right for function declarations, left for all else.

The only right way and you know it.
>>
>>61902405
I bet you still compile for C89
>>
File: 1488088115213.png (53 KB, 1106x734)
53 KB
53 KB PNG
I like to keep if statement brackets together and loops in a new line.
>>
if 
(condition) {
foo ();}
else {
bar ();}
>>
>>61885313
this kind
(if condition
(foo)
(bar))
>>
>>61902807
Go to sleep grandpa.
>>
>>61885609
>ternaries
>>>/reddit/
>>
I think lonely brackets look bad.
>>
>>61894565
>fn
>>
>>61895970
why is foo more right than bar
>>61902815
im a young black boy, I can like lisp too!
>>
If(
Condition
){
Foo();
}
Else
{
Bar();
}
>>
>>61885313
the right kind.
>>
>>61885546
this kind
>>
>>61885313
one who favours while loops and data validation.
>>
>>61885646
I unironically like this
>>
>>61888394
Great idea, improve readability by moving all the superfluous braces and semicolons ("meant for computers, not humans" amirite) off to the side. I wonder why this isn't the standard.
>>
after 25 years programming i'm tired of that, now sysadmin.
>>
>>61885546
I avoid this because leads to bugs and it's a pain in the ass when you want to add another statement. i'll do
if (condition) foo();
though.
>>
>>61885546
if(condition)
foo();
else
bar();
if(condition
anotherFoo();
else
bar();




Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.