Page 2 of 2
Posted: Thu Nov 13, 2003 12:21 pm
by maniac9
First of all, I don't understand what you people mean by C-style and Java-style, since they follow the same syntax, and work in both languages...I do mine the same in all languages...
Posted: Thu Nov 13, 2003 12:37 pm
by BDKR
maniac9 wrote:First of all, I don't understand what you people mean by C-style and Java-style, since they follow the same syntax, and work in both languages...I do mine the same in all languages...
I hear what you're saying. I chose a way and do it that way most of the time to until I get to work.
And there is the reason right there. When bodies of code start to grow in size, importance, or both, then conventions become important. And as a result, the need for being able to name and identify these conventions.
Personally, I think something is suspect with what we are calling C or Java style. Java get's it's style from C. So does C++ and Perl. When you get right down to it, what Kriek labeled as the Java style is what K & R themselves used years before Java was ever an Oak (If you know what I mean). To me the idea that Java would even have a style named after it is kinda obscene.
Cheers,
BDKR
Posted: Thu Nov 13, 2003 3:11 pm
by JAM
To me the idea that Java would even have a style named after it is kinda obscene.
Hehe... True.
The question about how we code are a neverending subject. I prefer the (obscene hehe) 'Java-Style' way, and I
think that thats the way I see it mostly. But as I said in another thread, I personally change the way I code to whom I code with.
At home, 'Java-Style'. At work, C-style.
Doesn't matter that much, as long as the idents and overall readability/comments is there.
Posted: Fri Nov 14, 2003 8:59 am
by Toneboy
C style - I find it clearer. Still have lots of scripts with Java style though, it seems to be most popular on online tutorials (of which I've read plenty). I'm not surprised that it is a narrow leader in this poll.
Posted: Fri Dec 12, 2003 3:13 pm
by onefocus99
I'm a Java Programmer and learned this first,
however I code C-Style.
I use only 3 spaces to indent
Then if there are alot of nested 'if statements' the logic doesn't go off the screen. I am Ho Ho for that.
Posted: Sat Dec 13, 2003 10:43 am
by uberpolak
I find going by the PEAR standard easiest to read. Whoever decided VB style coding should be part of PHP should be Google-bombed with the term "constipated yak."
Posted: Sun Dec 14, 2003 3:43 am
by devork
c-style gives you easy to understand code flow
it depends from which background you have more experience
c-style will be easy for c lang ppl and same for other.
Posted: Sun Dec 14, 2003 7:34 am
by BDKR
devork wrote:
c-style gives you easy to understand code flow
Don't they all aim (in some way) to give you easy to understand code flow?
Really, when you get right down to it, it's just an organizational issue. Norhing more and nothing less. How are things arranged, or even name (uderscores, studly caps, hungarian notation), will all help somebody to some degree. Beyond that, with the exception of python, ...
Code: Select all
fucntion shoot_gun(&$player)
{
fire_weapon(&$player->weapon);
register_hit(&$player); /* If the player actually hits something */
}
and
Code: Select all
fucntion shootGun(&$player) {
fireWeapon(&$player->weapon);
registerHit(&$player); /* If the player actually hits something */
}
...will work exactly the same. And when you get right down to it, this is a readability issue. Not one of code flow, which implies a concern with logic.
devork wrote:
it depends from which background you have more experience
c-style will be easy for c lang ppl and same for other.
And that's ultimately the 'it'. Python, Ruby, VB all look incredibly bland and just mushed together becuase there are no brackets, braces, semicolons, or parenthesis. For those of us with a foundation in a C like syntax, this is maddening at first. The only visual clues you have as to what's going on are things like indentation, white space, and new lines.
What if it's a n00b3 and he/she doesn't indent consistently. At least with a C based language there are still the braces. But in this case, Guido (the developer of Python) was smart and at least requries (at the engine level) indentation for code blocks. Having the indentation helps immensely.
Cheers,
BDKR
Posted: Sun Dec 14, 2003 12:09 pm
by Fredix
I voted for C-Style because I !!!HATE!!! what you call Java style, really!
I use that C-style in any language that has such block delimiters and even in pascal I handle those key words "BEGIN" and "END" as if they would be brackets.
Writing brackets in one column gives you the fastest overview over your code, while using "JAVA-Style" you need to _search_ the start of the code block.
For me there is no space for any other argumentation as I could not imagine that someone can read JAVA Style better.
I'm not concerned about VB so much because I hardly find anyone really using this a lot.