Im more the C Style. I like to be able to follow what ive done a bit without any of the comment marks needing to really help me.
It also makes it easier to help newbies as well.. But im noticing the Java Style being increasingly popular of late.
Im more the C Style. I like to be able to follow what ive done a bit without any of the comment marks needing to really help me.
It also makes it easier to help newbies as well.. But im noticing the Java Style being increasingly popular of late.
Ok. I give up.
Based on the example in the original post, just what is the supposed difference between C and Java style? The examples look identical. Was it a copy/paste error?
Originally posted by ahundiak
Ok. I give up.
Based on the example in the original post, just what is the supposed difference between C and Java style? The examples look identical. Was it a copy/paste error?
They're completely different.
One is like
<?php if ($a > $b)
{
print "a is bigger than b";
}
?> and the other is like
<?php if ($a > $b) {
print "a is bigger than b";
}
?>
If you look at it carefully, you'll see that the second one is more compact, but harder to read.
And oh, C-Style for me!
Combination of Java and VB. I like to keep in compact and it's still readable. And if you think it's hard to read, add comments. Even with comments its smaller then C style.
I'm a lazy coder, why waste time for entering spaces that are not needed?
My 2 cents.
Originally posted by rklapwijk
I'm a lazy coder, why waste time for entering spaces that are not needed?
My 2 cents.
Amen, brother! I am a lazy coder as well... I figure I may as well give the next guy something to bitch about and someone to blame when things can't be figured out 
-Elizabeth
really depends on the situation... functions and classes are always C style, but control structures are generally Java style... except for loops, which again are C style...
and my if/elseif/else look like this
if ($a>$b) {
echo "greater than";
} elseif ($a<$b) {
echo "less than";
} else {
echo "equal";
}
I guess I use 'roy' style...
In PHP for private projects I mainly use PHP alternative syntax, though of course I use indentation e.g.
<?php
if (conditionA):
//do something
elseif (conditionB):
//do some other thing
else:
//do something else
endif;
?>
The advantage in this is that indentation should be obvious (as long as one doesnt insist on writing everything on a very long line), and there are no braces to worry about.
If I'm working on an existing project, I simply use whatever style is in use.
For C++, I generally use the one true brace style (i.e. K&R), but place the closing brace on a line of its own.
Originally posted by Elizabeth
Amen, brother! I am a lazy coder as well... I figure I may as well give the next guy something to bitch about and someone to blame when things can't be figured out
-Elizabeth
I completely agree... plus, if they need a bug fixed (not that MY code would ever have a bug), I would rather the code be so hard to read that the only way they could fix it is to call me back in 
Originally posted by epimeth
if ($a>$b) { echo "greater than"; } elseif ($a<$b) { echo "less than"; } else { echo "equal"; }I guess I use 'roy' style... [/B]
Uh, hate to tell you, but that's the "BuzzLY" style... 
Originally posted by BuzzLY
..I would rather the code be so hard to read that the only way they could fix it is to call me back in![]()
Job security, naturally!
Kind of reminds me of the Microsoft way Ha ha!
-Elizabeth
hrmph... buzzly style my ass
and for really good job security, use that code obsufcation thing and keep a backup of the original somewhere... I know I'd hate going through code looking for function ArFddserghvgnhFgFSFGHRW()
but then again, thats what the edit->find is used for...
LOL
epimeth, you really should use punctuation. Were you trying to say "BuzzLY style, my ass" or "BuzzLY, style my ass?"
Hopefully, not the latter, since I am not really sure how to style asses... 
In any case, my point was that I code the same way you do -- I think it's compact, yet still easy to read.
print "a is ".($a>$b?'bigger'
$a==$b?'equal':'smaller'))." than b";
almost got kicked out of a training by a mentally chalenged trainer because I had had fun with 12 level of ?:; encapsulation and I could read it.
Maintenability = 0 though (retry in 6 month while sober)
Hey, I think we should start a new movement which relies on poor coding practices... let's just add tabs and space punctuation willy-nilly! No more "in the box" thinking- and why should we make it easy for the nimrods who come after us? No more comments! We know what we meant to code- that's all that matters!
Who's with me?! 
-Elizabeth
Yeah! I'm with you!
What shall we call it? I vote for "Broken Source."
I second that motion!
Looks like we need a moderator of some sort to make it official and add it to the poll.. ahem...

-Elizabeth
epimeth , same here.
Originally posted by Elizabeth
Looks like we need a moderator of some sort to make it official and add it to the poll.. ahem...
Yeah... wouldn't it be nice if that person were paying attention?
you wish is my command.
I have a valid excuse, I was winning a month long contract today starting on wednesday morning. 