Author |
Message |
Quan Chi2 Member of "Sexy Teenagers that Code" Group

Age:34 Gender: Joined: Mar 25 2005 Posts: 860 Location: NYC Offline
|
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
|
Back to top |
|
 |
Quan Chi2 Member of "Sexy Teenagers that Code" Group

Age:34 Gender: Joined: Mar 25 2005 Posts: 860 Location: NYC Offline
|
Posted: Sun Sep 04, 2005 7:39 pm Post subject: |
 |
|
|
|
lol
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Sun Sep 04, 2005 9:02 pm Post subject: |
 |
|
|
|
That's just nevermind anyways. _________________ Performance is often the art of cheating carefully. - James Gosling
|
|
Back to top |
|
 |
Donkano Server Help Squatter
Gender: Joined: Jul 02 2003 Posts: 763 Offline
|
Posted: Sun Sep 04, 2005 11:04 pm Post subject: |
 |
|
|
|
Mr Ekted wrote: | How about decent formatting (ie ekted style):
if (c->check("fgpic1"))
sendPrivate(p, "*objon 1");
else if (c->check("fgpicoff"))
sendPrivate(p, "*objoff 1");
if (c->check("fgpic2"))
sendPrivate(p, "*objon 2"); |
|
Ick. That is harder to read through than with the { and }. Besides, it isn't much of a size change.
Here is how I would do it:
if (c->check("fgpic1")) {
sendPrivate(p, "*objon 1");
}
else if (c->check("fgpicoff")) {
sendPrivate(p, "*objoff 1");
}
if (c->check("fgpic2")) {
sendPrivate(p, "*objon 2");
}
|
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sun Sep 04, 2005 11:24 pm Post subject: |
 |
|
|
|
Your way is gay. My way is perfect.
|
|
Back to top |
|
 |
Assassin2684 Server Help Squatter

Age:34 Gender: Joined: Jul 27 2004 Posts: 990 Location: Florida Offline
|
Posted: Sun Sep 04, 2005 11:55 pm Post subject: |
 |
|
|
|
I dont know, i kinda like baks way but then agin i like everythign neat. So my code is always perfect
|
|
Back to top |
|
 |
Donkano Server Help Squatter
Gender: Joined: Jul 02 2003 Posts: 763 Offline
|
Posted: Mon Sep 05, 2005 12:16 am Post subject: |
 |
|
|
|
Mr Ekted wrote: | Your way is gay. My way is perfect.  |
In your own little world I bet it is. But to others around you (like myself and Bak) it isn't.
|
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
Posted: Mon Sep 05, 2005 1:02 am Post subject: |
 |
|
|
|
I usually use Quan's way for multi line braces and Ekted's way for single line braces (or lack of them). Although I'd probably put an empy line before that final 'if' or change it to an 'else if'. At this point it's whatever feels right.
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Mon Sep 05, 2005 3:35 am Post subject: |
 |
|
|
|
Donkano wrote: | In your own little world I bet it is. But to others around you (like myself and Bak) it isn't. |
Don't quit your day jobs if you are going to code like retards.
|
|
Back to top |
|
 |
Cerium Server Help Squatter

Age:42 Gender: Joined: Mar 05 2005 Posts: 807 Location: I will stab you. Offline
|
|
Back to top |
|
 |
Maverick

Age:40 Gender: Joined: Feb 26 2005 Posts: 1521 Location: The Netherlands Offline
|
Posted: Mon Sep 05, 2005 5:40 am Post subject: |
 |
|
|
|
I would do it like Cerium but its more or less a coder's etiquette to code without brackets when there is only one line to be executed after an if() statement. _________________
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Mon Sep 05, 2005 6:26 am Post subject: |
 |
|
|
|
I prefer opening and closing braces to be on the same level so I can read the code quickly. Although I sometimes shove everything on one line if it's a short java accessor/mutator or small try/catch block (could be 8 lines otherwise).
|
|
Back to top |
|
 |
Maverick

Age:40 Gender: Joined: Feb 26 2005 Posts: 1521 Location: The Netherlands Offline
|
Posted: Mon Sep 05, 2005 8:27 am Post subject: |
 |
|
|
|
Mr Ekted wrote: | Most people code like they do because it's the way they were taught, not what makes sense. It's just like religion. People are sheep. |
Agreed..
Sheep_intro[1].gif - 7.82 KB
File downloaded or viewed 8 time(s)
|
|
Back to top |
|
 |
Donkano Server Help Squatter
Gender: Joined: Jul 02 2003 Posts: 763 Offline
|
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Mon Sep 05, 2005 10:29 am Post subject: |
 |
|
|
|
Ekted's way is obviously the way to go. Everybody gives so much weight to spacing everything out these days, it's retarded. Yes, I know really spaced out code is easier to skim, but if each block is well-commented, then there's no reason to skim the code. _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
|
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
Posted: Mon Sep 05, 2005 11:04 am Post subject: |
 |
|
|
|
so when you do a function, the braces start indented rather than against the left border?
|
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Mon Sep 05, 2005 1:31 pm Post subject: |
 |
|
|
|
I'm going to have to agree with Ekted here, and cite his style specifications, which I agree with about 95%:
 _________________
|
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Mon Sep 05, 2005 1:33 pm Post subject: |
 |
|
|
|
interesting; i agree with most of that, 'cept the method/function body not being indented.
|
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Mon Sep 05, 2005 1:35 pm Post subject: |
 |
|
|
|
Thats the part I don't agree with him on, I like to indent too
|
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Mon Sep 05, 2005 1:46 pm Post subject: |
 |
|
|
|
It's really non-sense as I stated earlier. Most IDEs provide the templated formatting. If not, you can find a lot of free code formatters/cleaners. We discussed in the Wisconsin Java Group, how it's much more efficient for a programmer to program his/her own style, run a cleaner/formatter to company standard, and then commit it. He did put the caveat that one should not run "diff" without formatting the code first .
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Mon Sep 05, 2005 2:23 pm Post subject: |
 |
|
|
|
CypherJF wrote: | interesting; i agree with most of that, 'cept the method/function body not being indented. |
You are correct Cyph; my function indenting is inconsistent with my general rules. It's simply because almost all the code in a file is lines of a function, and that would basically make the entire file indented. So I break my own rules for that one case.
Do we want to have the tabs/notabs debate as well?
|
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Mon Sep 05, 2005 3:33 pm Post subject: |
 |
|
|
|
NoOo.. lol. Seek post #46669.
|
|
Back to top |
|
 |
|