File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Cattle Drive and the fly likes Coding style Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Coding style" Watch "Coding style" New topic
Author

Coding style

soumya ravindranath
Ranch Hand

Joined: Jan 26, 2001
Posts: 300
Hi,

1. I was reading about the class member ordering section in the Style guide - why is there no mention about 'main' ? Is it to be always the last one when it happens to be ?

2. The Sun coding standard follows the following style, which I am used to too -



Cattle Drive follows,


which makes it look more like C++ code.

Any reasons for this ?

Soumya.
[ January 27, 2005: Message edited by: soumya ravindranath ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
There have been many discussions on this. Here are some, just from within this forum:

http://www.coderanch.com/t/4963/Cattle-Drive/Coding-style
http://www.coderanch.com/t/4609/Cattle-Drive/RFC-Coding-Conventions
http://www.coderanch.com/t/4531/Cattle-Drive/Style-guide
http://www.coderanch.com/t/3729/Cattle-Drive/handling-braces
http://www.coderanch.com/t/3739/Cattle-Drive/Javaranch-programming-style
http://www.coderanch.com/t/4500/Cattle-Drive/Operator-precedence

If you search in other forums like Java in General you can find many more, less centered on the JavaRanch Style Guide.
[ January 27, 2005: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
Kate Head
Ranch Hand

Joined: Oct 31, 2002
Posts: 67
...and if you don't use the Style Guide for your code in the Cattle Drive assignments, you get nit-picked (as I've found out!).
All the best,
Kate!!
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
... me too, Kate!

Hi Soumya,

1. I was reading about the class member ordering section in the Style guide - why is there no mention about 'main' ? Is it to be always the last one when it happens to be ?

In section 1.3 - Class Member Ordering, "Keep private methods above the methods that use them ...". Omitting the word private, I think it's interpreted as:



Anyway, I got nit-picked on the ordering of the methods twice, including main().

Joyce
[ January 28, 2005: Message edited by: Joyce Lee ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9053
    
  12
As for having a style guide different than Sun's, one of the things we want a student to learn is flexibility. Not every company uses Sun's style guide. You need to be able to follow their style guide regardless of your opinions about it.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
soumya ravindranath
Ranch Hand

Joined: Jan 26, 2001
Posts: 300
Thank you all, I have always been a staunch supporter of following some Coding style
And sorry Jim, it didn't occur to me to search on Cattle Drive
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Coding style