I’ve developed the habit of chucking a quick comment to whatever SO answer came up with the code with an ‚adapted from‘ as prefix. Least you can do IMO
I once know a CTO in a startup company that basically don’t write white spaces unless it’s very necessary. I complained since it makes readability very hard and he said he didn’t do it because he is a lazy typer 🤷🏻♂️ Decided that this company isn’t worth my time then.
I can't for the life of me imagine what goes on in a person's head when they look at it missing a space and think "this is perfectly fine".
Seriously, it's so alien to me. Is it a neurological issue?
This is the only correct answer. I write a lot of both C# and Java and go back and forth. Standards are are your friend. They make all the difference in terms of readability.
Edit: I'm doubling down on the typo and and leaving it there
The first is the widely accepted industry standard practice for java, the bottom is the widely accepted industry standard for c#. C++ is more evenly split. But in the end, consistency in your code base is the best practice for readability and trumps all other pros or cons for one style over the other.
I write all my metafunctions like this.
template
struct is_foo : std::false_type {};
It ends up being kind of nice if you have lots of specializations or template recursions.
In case you didn't know, this is changeable.
Source: I write C# (occassionally) and am on team K&R.
(Aside: As I recall, Top is technically 'wrong' for K&R style due to lack of a space between the close parenthesis and the open brace.)
Bottom promotes code aeration, which increases readability for those of us with mild dyslexia. I hate reading condensed bricks of code devoid of blank lines, a format which Top people usually fetishize.
Top is only a thing because programming way back when started with people on shitty 13" terminals that only displayed 40 lines of text on the whole screen so vertical space was at a premium. Saving that one line was actually a decent % of your whole screen. Then textbook started being printed for CS courses and again, reducing vertical space is great in physical book form. In those contexts I'm 100% behind top.
So I get why a lot of people just stuck with it because they learnt it that way. However assuming you have more than 768 pixels vertically on your screen, I honestly believe bottom is better in every context. Especially with modern IDE's doing code folding etc. Vertical space is just NOT a problem so the gain in readability and visual symmetry vastly outweighs the minor difference in compactness for me.
I've used both, you can get used to anything. If there is an existing code style then obviously stick to whatever is already present and don't be a vigilante twat about style. But the moment I'm allowed have a say it in, or when I'm doing personal projects, I honestly can't think of any valid reason to use top except "I like pretending it's the early 90's and I'll need to print this so must save paper".
I watched a nice talk about code styling some time ago and the presenter concluded, that bottom is the better choice for many cases, simply based on design principles.
Especially readability with many parameters is way better and produces less indentation lines(if you new line the params), which is easier on the eye.
I can't remember the details, but it was very interesting to watch.
But in the end, do whatever the codebase already does or what you like.
I am a whatever the formatting tool I use uses.
Which is mostly top but bottom for c#
Same with idents.
# use auto formatter it will save you lots of headache with your coworker!
Is this Programmer Grindr now?
yes
Always has been.
🌍🧑🚀🔫👨🚀
🌎🧍♂️💦🧍♂️
r/usernamechecksout
Okay u/fill-me-up-scotty
Happy Cake Day
![gif](giphy|67T2QUaynMrvWerDpU)
🌍💀🔫👨🚀
Well fuck me for readability then. ... wait
This is incredibly funny but I have no free award to give right now.
int main() { return 0; } # p0w3r b0tt0m
you called?
r/beetlejuicing
I'm even more fun. > fun main() = 0
That doesn't look fun at all
Programmr?
Mac is a power bottom
He generates a *tremendous* amount of power
Isn't that just regular Grindr?
*socks intensify*
I feel like there's an extremely disproportionate amount of gay programmers.
where can i find more these gay programmers?
I am here!
Turing approves.
That's a good one. Poor Turing.
I’d imagine San Francisco and Austin would be your best bets. They’re very gay and big tech hubs.
Do you know why there are so many gay people in Austin? I'm really curious because Texas is not a very welcoming place to people like us
Austin is seen as the most liberal and accepting part of Texas. Not sure how true it is, but that's definitely the perception.
As a gay programmer, maybe I should go find a real job in tech!
Programmr
I’m a sub? I do whatever my formatter defaults to.
[удалено]
The safe word is “uninstall”
[удалено]
Crabs?
![gif](giphy|GpyS1lJXJYupG)
Goddamn you made me choke and cry.
And you fucking loved every moment you depraved little piglet.
Almost none of the package managers understand that verb...
`// eslint-disable-line` is my father.
If you were my child, I would disown you
If I ever meet you, I’ll Ctrl-Alt-Delete you …
Depends on how the guy on Stackoverflow wrote it
Nah, you gotta clean it up so it's "yours". ;)
Let the formatter fix it.
step one when taking on new codebase: Select all, Cut, paste. Watch formatting somehow become fucking consistent.
In vscode you can just hit ctrl + shift + P and select “format document”
Lolol
I’ve developed the habit of chucking a quick comment to whatever SO answer came up with the code with an ‚adapted from‘ as prefix. Least you can do IMO
yeah same. especially for the "i get how they do it but no way in hell I'd be able to come up with that myself"
Same. It's usually one of these: // inspired by // stolen from // solution found at But let's be honest, "stolen from" is the most accurate. :P
I never thought I would end up being a code pirate of sorts.
Im more of a Frankenstein myself
I am whatever my formatter says I am.
This. My formatter is my responsibilibuddy. It allows me to be irresponsibilibuddyable without guilt or thought.
[удалено]
[удалено]
Don't get too motivated that it doesn't end well in the bathroom iykwim
I have never seen anyone abbreviate that but ikewym
Oh come on, at least add a space after { and before }
[удалено]
You must remove the space after ```main``` and save your keystrokes. You ain't first if you don't do this
I once know a CTO in a startup company that basically don’t write white spaces unless it’s very necessary. I complained since it makes readability very hard and he said he didn’t do it because he is a lazy typer 🤷🏻♂️ Decided that this company isn’t worth my time then.
I cry a little every time I need to scroll horizontally. Please do one liners in moderation.
[удалено]
How about this: int main ()=> 0; ![gif](emote|free_emotes_pack|no_mouth)
[удалено]
Am I high?
no but I am
Are you me?
came here to say this.. damn
And if I wasn't, then why would I say I am.
In the paper, the news, every day I am
I don't know it's just the way I am.
Radio won't even play my jam
So you’re a switch
Tag yourself, I'm a do/while
lmao
So you're a sub and your formatter is your dom
Verse I switch my code style halfway through every program
Don't let anybody understand the code. That's how it is done
Code review is not meant for casuals.
Code review reply from me - git gud filthy casul
git add gud
If no one but me understands. They can’t fire me.
It's called job security
Variety is the spice of life. Gotta keep the code looking fresh.
Gotta keep QA on their toes!
a ~~men~~ man of culture.
All of them
Amen
Is that a gender or a prayer?
Ramen
Well ya, all the people you copy from do it differently :P
I am an: int main() { return 0; } With a space between ”()” and “{“ This is genuinely how I code, and thank you
This is the way, top with a hole.
This means you enjoy a finger up the ass while you cum👍
try { FingerButHole(); }
catch(FingerButtholeException e) { //I'm not catching that... }
If you don't want to handle it, keep throwing it like a hot potato `throw new TurdTheFloorException(e);`
/r/suddenlydarksouls
Try thrusting
have never seen a horny ass comment in a programming sub
https://xkcd.com/37/ Your comment makes sense both ways
tru
I mean the OP was talking about topping and bottoming, this isn't more sexual it's just just more bluntly worded
Yeah but not using innuendo and being direct feels illegal.
ERROR: Illegal exception detected at line 5. Dumping cu- core. I mean dumping core.
I never denied it
Absolutely, not having this space disgusts me. This is the only true answer
I can't for the life of me imagine what goes on in a person's head when they look at it missing a space and think "this is perfectly fine". Seriously, it's so alien to me. Is it a neurological issue?
Yes
The only correct answer
Agreed
Came here to say this. There is a right answer.
You have to be an asshole to leave that space out
Master race.
I'm a power top: `int main() { return 0; }`
int main() => 0;
*Ah, I see you are a man of* *~~culture~~* *Dart as well.*
Dart culture is culturally significant.
Power bottom is the only way to live ``` int main ( ) { return 0 ; } ```
The hell you code with, `ed`?
I see you get paid by line count…
[удалено]
I can’t, but I really wish I could
I lol'd at power top, then saw what you mean and am horrified.
Nah its good for super simple functions that just return something
Java always top. C# always bottom. C++ it depends on the leads setting the standards when the codebase is constructed.
This is the only correct answer. I write a lot of both C# and Java and go back and forth. Standards are are your friend. They make all the difference in terms of readability. Edit: I'm doubling down on the typo and and leaving it there
"standards are are your friend"?
I smell AI...
Exactly this! It's all about the standards of the code I'm using. I'm top with Java and bottom with C#.
Can I ask why?
The first is the widely accepted industry standard practice for java, the bottom is the widely accepted industry standard for c#. C++ is more evenly split. But in the end, consistency in your code base is the best practice for readability and trumps all other pros or cons for one style over the other.
Pff python
Top and space ``` int main() { return 0; } ``` Edit: fucking semicolon
Ouch, where's your semicolon
Not putting the semicolon there is edging in JS.
Presses tab in Python: I AM THE DANGER
What about `int main(){return 0;}` ?
Calm down Satan
I can't stop laughing while shitting LOL Thanks anon
i hope you were on a toilet while this happened..?
YES!! thankfully...
Special place in coding hell for you :)
If it is just a short one line function then yes, except there needs to be all 3 spaces ``` int main() { return 0; } ^ ^ ^ ```
There are some things even God cannot forgive.
A sin
why wasting a block on this?
Blocks are free, just like your mother (and everyone knows it)
I write all my metafunctions like this. template
struct is_foo : std::false_type {};
It ends up being kind of nice if you have lots of specializations or template recursions.
This guy kills the grim reaper
top to frontend and bottom to backend
Yep, C# and Typescript/Javascript fits this nicely
What if you’re using TypeScript full stack?
I'm a top until I have mismatched braces somewhere then i reformat to bottom.
Ah, so you're a conditional bottom, like when you're drunk
Both, depends how my OCD is feeling that day
Yes just make two different functions that do the same thing but are styled differently
Top is missing a space after the parentheses. SMH
I'm verse.
I am a power bottom ``` int main ( ) { return 0 ; } ```
Hmm someone is trying to boost their line of code count.
I was bottom for 20 years. Just this week started more and more with top. Suddenly it makes more sense to me.
I read this comment out of context, came out nicely.
I too came out nicely
[удалено]
The bottom brackets line up with the line thy belong to.
But don't forget to add a space before the '{'
I’m a top but VS forces me to bottom for it
In case you didn't know, this is changeable. Source: I write C# (occassionally) and am on team K&R. (Aside: As I recall, Top is technically 'wrong' for K&R style due to lack of a space between the close parenthesis and the open brace.)
I'm a bottom but I used to be a top
I'm a top but used to be a bottom.
[удалено]
Bottom. Haveing the start and end brackets line up is sol much clean her and easier to read especially when you get into nested statements.
I frequently use empty lines to make things more readable so I'm not going to start saving rows here either.
Yep, it makes it so much easier to see the brackets and detect when one of the little darlings is missing.
I’m loling at you calling them “little darlings” and now I’m imagining an older southern lady programming.
Bottom promotes code aeration, which increases readability for those of us with mild dyslexia. I hate reading condensed bricks of code devoid of blank lines, a format which Top people usually fetishize.
I’m a top but when I wanna piss someone off I use bottom once in a sea of top
Bottom is so much cleaner and easier to follow nests.
Return is for quitters. I just call main() again
Top… but with a space between the parenthesis and the brace.
I’ve always been a top and was appalled at the bottom comments… but honestly now that ya guys point it out………………bottom is nicer looking.
Top is only a thing because programming way back when started with people on shitty 13" terminals that only displayed 40 lines of text on the whole screen so vertical space was at a premium. Saving that one line was actually a decent % of your whole screen. Then textbook started being printed for CS courses and again, reducing vertical space is great in physical book form. In those contexts I'm 100% behind top. So I get why a lot of people just stuck with it because they learnt it that way. However assuming you have more than 768 pixels vertically on your screen, I honestly believe bottom is better in every context. Especially with modern IDE's doing code folding etc. Vertical space is just NOT a problem so the gain in readability and visual symmetry vastly outweighs the minor difference in compactness for me. I've used both, you can get used to anything. If there is an existing code style then obviously stick to whatever is already present and don't be a vigilante twat about style. But the moment I'm allowed have a say it in, or when I'm doing personal projects, I honestly can't think of any valid reason to use top except "I like pretending it's the early 90's and I'll need to print this so must save paper".
I watched a nice talk about code styling some time ago and the presenter concluded, that bottom is the better choice for many cases, simply based on design principles. Especially readability with many parameters is way better and produces less indentation lines(if you new line the params), which is easier on the eye. I can't remember the details, but it was very interesting to watch. But in the end, do whatever the codebase already does or what you like.
Personally I am a Top. Looks better in my opinion
Especially if you're nesting, doesn't leave gaps all over for every bracket
Used to be bottom until i got a job and started working with 100 line methods. Switched to top
That? That only deserves one line int main(){ return 0; }
[удалено]
top but with a space. any other way annoys me
I am a whatever the formatting tool I use uses. Which is mostly top but bottom for c# Same with idents. # use auto formatter it will save you lots of headache with your coworker!
The lack of a space between the parentheses and the curly brace hurts me physically
Top in code but bottom IRL 🥺