Why do people think it is okay to write code that looks like this?
Why do people think it is okay to write code that looks like this?
Other urls found in this thread:
>Not in Darkula
Honestly, tabs, spaces, claudator positions end of line, all should be handled at client side like Jason files opened with Firefox.
not a fan of oop or
whats wrong with it? most prettifiers output code formatted like that
wat
yeah keep declarations and full functions way away from each other, especially when they're that long.
Obvious bug line 2 but Jow Forums retards won't pick it
It's the prefered style for Java.
Try taking a durgasoft course sir
Every { should be in a line of their own. As should every }.
This appears to be Java, and it is a part of the Java style convention to write that way.
because it's fine
you can be wrong somewhere else, fag
Imagine being this retarded
retard
t. visual studio fag
>constructor directly below properties
that shit gave me cancer
other than that, opening braces should be on a new line, fuck sameliners
kek
explain
>especially when they're that long.
Clean Code fags can't even write a basic binary tree insert without becoming nervous Uncle Bob is going to strike them down for excessive function length
>have 4 bytes of payload
>have 16 bytes of pointers
>use a total of 32 bytes due to alignment
>have no method to actually access the value or do anything with it
>might as well not have written anything
Of course that's not what OP is referring to. The whole thing is fine if you assume that it's a mock-up to demonstrate some coding style.
>have no method to actually access the value or do anything with it
are you retarded
left.value; //can get the value
left.value = 11; //can set the value
What about this
clearly i'm retarded because the field is named "data" not "value"
} else {
Fucking disgusting
If you do this, kill yourself
}
else {
why
found the autistic faggot.
>properties
what are you smoking
So if you insert 3 into the list {2, 4} it goes into an infinite loop?
is that NETBEANS?
No it's inserted into 4's "left"
The only thing wrong with that code is not adding a new line between the fields and constructor.
Fuck java syntax, people should write java as close to C89 as possible.
The mixing of a public method in a package-private class (which is in itself retarded unless it is implementing an interface) tripped me up.
My other excuse: using C++ these days.
Imagine employing the person who posted this.
There is literally nothing wrong with this.
>Imagine using java
jGRASP
jgrasp.org
Tail recursion.
Kill yourself. You're fucking disgusting.
Pic related is the only correct way.
I hope this is bait.
Is there a away to remove all unnecessary white spaces before I roll it out for usage?
lol
Not a bug, retard
not op but I hate it
>no space after if
That's objectively incorrect
>new
lol retard
Most of the C/C++/C# code i saw use this style.
After using JS for a year going from
if(){
}
to
if()
{
}
was blessing
far more comfy but....
I hate your formatting symbols, that won't survive an editor change
if(test){do shit}
else {do different shit}
If is not a function
Fuck you.
but 4's left is 2, the two nodes will keep calling the insert method on each other because there is no way to create a new node between them.
The former is better because it wastes less space on dumb braces
On the topic of formatting, whats the proper way to format a complex for statement with a single statement loop.
Generally I like to push oneliners into one line; but for statements with their containing 3 sub statements likely can't fit on one line if your off the standard path
if you have to think about it, break it up
Not what I mean
for( int i=0, j=0; i < arraysize ||
j< j_max || MARCO_SHOULD_I DO_ANYTHING_AT_ALL; i++){
iterate(array[i],&j);
}
This feels anti comfy no matter how I set it up
For statements should be simple. Also I think you mean && in your condition.
>I shouldn't use my language
if(MARCO){
int i=0, j=0;
while( i
Forced indentation with tabs and every tab should be 8 characters wide.
there are addons that will squeeze lines with braces so that 2 of them occupy space of 1, but keep readability the same
Based
Retards
You are supposed to trace the curly brace up to the opening curly brace.
>but keep readability the same
So completely fucking unreadable?
Kill yourself you absolute mongoloid.
The space in the closing bracket denotes something; it clearly shows that the code block is ending. When opening brackets are on the same line as the if, this gives the near whitespace of a bracket line a clear meaning. You don't get that effect with opening brackets being on their own line. The nearly blank line can have two meanings, the start of a new block of code (which is already indicated by the if statement in the fucking first place, and is meaningless without parsing that if statement) AND the end of the code block.
It's not just a matter of saving space. { being on its own line makes code actively harder to parse quickly. More spacing doesn't mean more readability. Spacing only increases readability when it has a clear purpose.
Does your brain work at he speed of a newt or something you fucking cretin? You shouldn't need to do that unless you have negative working memory. You close the current statement. Where that statement started is irrelevant because there's only one possibility.
fields
or variables, whatever you want to call them, negro
based
if it was a way to write real (not meme) programs
whole windows 2000 sources, linux and freebsd would look like this.
> (wall of text)
that is a nice argument and all, but putting the code after an if-statement in a block is optional
so actively hiding the opening brace makes it harder to tell whether a brace was opened.
>Preprocessor directives
Disgusting.
Platform should be an enum and there should be a switch statement to select the code for the right platform. The API should be consistent across platforms, and it should be up to the compiler to optimize away the whole switch structure by making the platform a const
but to be fair, everybody uses fucking #PreProcessorDirectives
...
Then the place of a curly brace is irrelevant and everyone who's replied to the based newliner is just an autistic nigger
Not putting code after an if statement is rare enough to be a non-issue.
Just put { } on the next line or something. It's janky and non-standard but you're already going to have people stopping and wondering why the fuck you did what you did so who cares.
No, putting it on a newline still has all its drawbacks, with literally zero upside.
>not doing :
>{ [ENER] } [UP] [ENTER] [TAB] ...
if(x)
{
do y;
};
Why yes, I do have sex every day. What gave me away?
There are literally no drawbacks. Everything you said in is just rambling. Opening curly brace signifies beginning of a code block, closing curly brace signifies the end. Everything else is inserted as an eye sugar and is irrelevant as it's ignored by the compiler.
There are drawbacks for readability which is the only factor there is to consider, because of exactly what you said in your post.
But it's perfectly readable in both cases, code is indented so you probably don't even register the braces unless you are actively looking for them.
The only time a { should be on its own line is after a function. Every other instance of { should be at the end of a line; for/while loops, if statements, structs etc.
The reasoning here is that functions cannot be nested like the other examples.
>discarding the entire subtree in == case
also this
That's how it's done
void my_function(std::string my_string){
if(my_string == "something"){
//do something
}else{
//do something else
}
}
Also if you use the hungarian notation you're aHumongusFaggotAndYouShouldKillYourself.
kill yourself
Go dilate.
void my_function(std::string my_string {
if(my_string == "something") {
//do something
} else {
//do something else
}
}
ftfy
>passing a string argument by value
yikes
cope
Keep crying bitch nigga.
Acceptable.
back to your designated shitting street, pajeet
>Why do people think it is okay to write code that looks like this?
It's not THAT bad. It could be tided up a bit, but at that scale it's still understandable.
The one thing I hat about go is that gofmt does this.
if (condition) {
// statement
}
if (!(condition)) {
// statement
}
How about
for( int i=0, j=0;
i < arraysize || j< j_max||MARCO_SHOULD_I_DO_ANYTHING_AT_ALL;
i++){ iterate(array[i],&j);}
?
implying muh()
{
if (lines)
{
of;
}
else
{
codes;
}
}
learn Clean Code you bunch of monkeys
>The reasoning here is that functions cannot be nested like the other examples.
But that's false
public void insert(int value) {
Node child = value
everything is a reference in Java user