Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I've never preferred one format over the other and have never understood the pious devotion to either of them. They both work, so I've always simply followed whatever convention was already in place at the company or within an existing project...they both seem easy to read to me, so why does it matter?
-
@FrodoSwaggins hmm I don't think I'm a good guy anymore :(
But both seem fine to me, but your if statement horrifies me. -
olback109817yDepends on language. I always put my curly braces on the same line in js and php but only sometimes in c/c++.
-
I like my curly brackets always on the same line, because the code then looks like this, which makes blocks easily readable
******
*****
****
********
*****
***
*****
***
** -
hexc11267yI used to program with the { on a new line but the longer I programmed I began prefering it on the same line and now hate the look of the new line version. Technical both are fine and even IDEs don agree on which is better.
-
I program in Python and mainly just ad-lib random shit with list nested list comprehensions.
-
TobyAsE28447yI believe this is not general coding advice but rather a coding guide for a specific project. And if whoever started the project decided on one way to do it, this is the right way to do it for this project.
It is very bad if the code style changes mid-file just because another dev worked on it and pushed his own favourite style.
Same thing applies to tabs/spaces.
Use the Auto-Format of your ide (it is configurable, surprise!) and don't worry.
Looking to update the way I write my code to follow:
- Coding Convention
- Standard Work
- Coding Standards
- Whatever other name they call it
And found this...
rant
coding conventions