Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Coding style

 
soumya ravindranath
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Kate Head
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...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
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... 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
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
soumya ravindranath
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic