• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Coding style

 
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 ]
 
Wanderer
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 ]
 
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!!
 
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 ]
 
Sheriff
Posts: 9099
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
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!