Page 3 of 3
Re: What's Your Coding Style?
Posted: Sun Feb 28, 2010 6:58 am
by Owen
Creature wrote:NickJohnson wrote:
looks pretty much just as clean as this:
Agreed. I'm pretty fond of this style myself too. The first one doesn't really bother me but I think the last one is a bit too cramped to read it easily. I also don't know why people like to use Java-style braces:
I've never liked this way of doing things. Especially with the whole tab/space debate (it doesn't matter which one you're using), it is very nice to have a new-line for this kind of statement because this way the braces will be on exactly the same indentation level. This makes it easier to see what ends where.
is far easier to read IMHO.
The first style is actually K&R style. It only becomes Java style when you do the same after function definitions.
As for why I don't do it: I spot the depth of the code by it's indentation level, rather than that of the surrounding braces, and putting the { on the same line as the condition saves vertical space (Which means I can look at more code at once without it becoming cramped)
Re: What's Your Coding Style?
Posted: Wed Mar 03, 2010 9:16 am
by paolodinhqd
my coding style is quite different
constant: MY_CONSTANT
numeric variable: my_numeric_variable
(pointer variable is considered as numeric,
coz it's actually numeric)
structured variable: My_Structured_Variable
class name: my_class_name
(different to most of u guys, my class name is not capitalized)
function name: my_function_name
indent of 2 spaces for levelling
Re: What's Your Coding Style?
Posted: Wed Mar 03, 2010 11:18 am
by Synon
Owen wrote:The first style is actually K&R style. It only becomes Java style when you do the same after function definitions.
As for why I don't do it: I spot the depth of the code by it's indentation level, rather than that of the surrounding braces, and putting the { on the same line as the condition saves vertical space (Which means I can look at more code at once without it becoming cramped)
I used to do what you're calling "Java style" (I've never used Java, so I wouldn't know) but I decided K&R/1TBS is more readable. Originally I used ANSI/Allman style, though.
Re: What's Your Coding Style?
Posted: Wed Mar 03, 2010 11:34 am
by Combuster
For the record, I'll just go for the ANSI +1
What matters more to me is the presence of comments, documentation, designs and readable names. I have the tendency to just copy over the formatting when working on existing code.
Re: What's Your Coding Style?
Posted: Wed Mar 03, 2010 1:29 pm
by Owen
Combuster wrote:For the record, I'll just go for the ANSI +1
What matters more to me is the presence of comments, documentation, designs and readable names. I have the tendency to just copy over the formatting when working on existing code.
I agree there. I only reformat code when the original style is unreadable.
I do tend to miss things like spaces before parentheses though; for projects which do that and I haven't noticed, I tend to get the patch tossed back at me till I fix that
Re: What's Your Coding Style?
Posted: Wed Mar 03, 2010 7:31 pm
by VolTeK
when it comes to me, im use to it bein just me readin it, cus im so messy with my work. theres barely ever a space. makes it harder to define the problems.. but it all works out some how in the end
Re: What's Your Coding Style?
Posted: Thu Mar 04, 2010 6:33 pm
by AaronMiller
Re: What's Your Coding Style?
Posted: Thu Mar 04, 2010 8:04 pm
by Synon
That isn't convenient, it's just annoying. I don't mean to be rude, but I don't want to have to scroll through all that text I'm not going to read just to read the posts below. Could you remove it, please? The link is fine.
Thanks.