Do you have a personal programming style / quirks, Sup Forums?

Do you have a personal programming style / quirks, Sup Forums?

while (true)
{
Something;
Somethingelse;
}

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

why isn't this an option

...

THIS

this one is the only acceptable answer

> The muh-python-style brainlet

Delet this

...

Brackets always on their own line
int main (void)

when you need to make line of code longer than spacing to bracket, do you split it in two or shift everything couple more spaces?

Eh, imo putting the curly brace on the same line in extremely large applications makes it harder to read. You don't really care about using up more lines, and the 'grouping' is easier to digest when you are looking at thousand line files (especially old embedded C projects).

As long as you are consistent either of those two methods are okay though.

The only people who use this coding style are genuine geniuses and have every line planned out down to the character count before they even begin typing.

I always preface private variables with an underscore so then the getter method can just be the name of the variable.
Like:
private int _x;
public int x() {
return _x;
}

code smell

Rate my code

>virgin code vs chad code

I don't give a shit how your code looks like. If you have tests (and 100% coverage) for that, you are fine.
Otherwise you brought shame on your family for generations to come.

ahh, the 100% test coverage meme. very good.

Of course! What better way to secure future employment is there than to write code that only you can maintain?

>wrapping

...

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


One Line for everything.

>That faggot that has a programming quirk and doesn't just follow the conventions of the language or the style guide written by the team before he came on board

Seriously kys, you're always a detriment

You could cut down on code by removing redundancy. Replace width with shirtWidth, shirtLength, and shirtSleve.
In the first if statement you would need all 3 to have width >= 18 && width

Its surprisingly easy to reach 100% test coverage. If you would take development seriously, you would know.

When i mean replace with shirtWidth, shirtLength, and shirtSleve I mean respective to the values you need to keep the same application logic.

You could also do something like console.log(calculateShirtSize(shirtWidth, shirtLength, shirtSleve));
Reduces the number of print statements you have and seperates your code to to where you could do tests. (assuming that you are interested in tests.)

If not using 3 you deserve to be gassed.

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

Depending on the language you can just use `this` or `self`. No need.

Compiler error

while(x==y&&(something()||1)&&(something_else()||1);

#4 is fucking gay and reeks of GameMakerLanguage. The only thing worse is Ganoo's style

while(x==y&&(something()||1)&&(something_else()||1));

IMO would be cleaner as a switch statement, like:

switch(true){
case (shirtLength > 10
&& shirtLength == 5):
console.log('asdf');
default:
console.log('asdf');
}

boss()->getFreeWorker()->doTheShit();

Order of preference:
1)Style that is already used in codebase
2)Standard style, if a language has one
3)Allman style

I'd prefer something like this:
while (0 == x - y) {
something();
somethingelse();
}

I can't count the number of times I'd written something like "x = y" by accident and had the loop continue forever.

define( 'true', false);
if( equals( (compare(x,y) === bool(true), negate_bool(false)) {
} else {
dosomething();
dosomethingElse();
}

Just like a real pro in obsoletnes of verbal construct.

This is me. The spaces and everything. Thank you

$a = repeat( (x,y)->= )->{something;}
$a->attach( = )->{somethingElse;}

Parsers are parsing, pracels are pracling, arguing about whitespace is worse than being black, if you don't get first line,

while x == y:
do_something()

See how simple Python is? I'll trade curly brackets and semicolons on every line for white space any day of the week

Attach to loop of running thread in phyton, please explain how this works.

That's even worse than offside rule

Killing robots in attempt to differentiate hardlearn is punishable crime.

while(x==y&&(something()||1)&&something_else()||1);

perfectly works without second parentheses

wrong

...

...

do( [ x==y, something(), somethingElse()] );

do( [ x==y, [something(), somethingElse()] ]);


do( x==y, [something(), somethingElse()] );


do( x==y, something(), somethingElse() );

Paranthesis is to be loved!

Used more paranthesis, twice,
Just one less closure.

valid point is, this can have optional thread, or even process starter.

while can too, but...
do is shorter.

I still can't realize even the fact there are multiple type of brackets, you just don't have unclosed brackets and close brackets in eachother,

But just for the fun, we can use even as brackets.

the only sane answer

>the curly brace on the same line in extremely large applications makes it harder to read
Utter bullshit, and I really doubt you coded anything in your life from this sentence alone

I pad everything with whitespaces. I put them between parenthesis, between math signs, even between brackets. Because fuck having special symbols clump together with the text.

(x==y)? do( dosomething(), dosomethingElse() ) :;
Why you fucking while, if it's just a ternary?

{} could be finaly be whiltrue,

infinite loop then

what if something or somethingelse false?

the first two appear to be exactly the same.
This is the correct answer

its not about line count, its about code folding. When you collapse functions that arnt being used it looks alot neater. take for example
function1(){
function2(){
function3(){

vs...

function1()
{
function2()
{
function3()
{

only faggots do, use a lint

while(true){
Something;
Somethingelse;
}
[code/]
that is my way

how could you have fucked up this badly?

While(x == y){
something();
somethingelse():
}

Gross. You should make a ShirtParameters object and sort from there.

Not applicable to his code snippet, but how do you reach 100% test coverage on a program with more permutations than there are nuclei in the observable universe (which isn't that hard or uncommon)?

This.

This is actually brilliant.

Nobody does this?

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

What about
while(X==Y) { something( ); something else( );}

This makes me actually want to write a Java parser which allows white-space indention syntax.

1) If it's not a class or control stucture, add ";" add the end of the line.
2) Check white spaces at the beginning of the next line and add braces according to the difference to the whitespaces at the current line..

hardcoded numbers. -1/10

>Its surprisingly easy to reach 100% test coverage.

Depends on what you call "coverage".
It's not that hard to test each functionality you made.
It's hard work to test each functionality enough, so you can reasonably expect your code to work if you refactored and your tests still run.
It's impossible to test each funtionality in taht way that you can be 100% sure everything works as long as your tests pass.

That's why fuzzing is a thing for example.

Dude, you should serisouly get into abstraction.
How about somehting this?

selectModel = ["S", "M", "L", "XL", "2XL", "3XL"]
selectShirtWidth = [18, 20, 22, 24, 26, 28]
selectShirtLength = [28, 29, 30, 31, 33, 34]

var wid=0;
while (shirtWidth

Ah, wait, I think last line has to be "console.log(selectModel[i-1])" since you are raising "i" until it's too big.

Nevertheless, you get the idea..

Stop being "this guy".
Read SICP.

for an autist, maybe

while (x == y)
performTasks();

performTasks() {
something();
something else();
}

>something else();
Fucking autocorrect

I indent switch cases like this:
switch (a)
{
case 1:
//
break;
case 2:
//
break;
default:
//
}


I know, I'm scum... 1TBS is the best, but I disregard it for this particular case.

OBEY CODING STANDARDS

not necessarily the wrong approach, but a bit of formatting would make it a ton more readable, e.g.
def typeFromSizes(w: Int, l: Int, s: Double) =
if (18

>Stop being "this guy".
rich, coming from someone who's code
- does not handle sleeve sizes
- requires more thought to understand, compared to a better-formatted version of the original

and is full of mistakes
- using wid/len, then suddenly switching to i/j
- off by one errors
really not giving noobs confidence in what you write there m8

if(x==y){
something();
somethingelse();
} else{
dontneedspacesunlessitselse();
}

Ah shit, I just noticed I renamed the variables from "i"/"j" to "wid"/"len"..

i never do one liners like if(something) do something;

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

while( x== y){
something();
something_else(); // or somethingElse depending language
}

Image upload error thread.
Spread it.

FUCK YOU

Remind me of that asshole in uni who would turn his functions into a single line after testing them.
>Dude, there's a mistake in your function
>Let me decompress it so I can debug it.

hmm never thought of the Horstmann version but it looks breddy good

Swift is nice, it even allows for this kind of travesti.

this

>NWO
>SHILLS ERRYWHERE
>EVERY OPINION I DON'T LIKE IS A SHILL
>EARTH IS FLAT
fuck off you spastic poltard

I, almost autistically, always align blocks of assignments.

a = 1
aaaaa = 2
aaaaaaaaaaaa = 3


becomes

a = 1
aaaaa = 2
aaaaaaaaaaaa = 3

that's not autistic, I do that too, specially with arrays.

I'm a brainlet so I look to those smarter than me who I respect.
So I use openbsd style.

>extremely large applications
the size of an individual block of code has nothing to do (or at least should have nothing to do) with how big the actual application is.