File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Assignment code indentation...help!

 
Andrea Gazzarini
Ranch Hand
Posts: 125
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure about the coding conventions of my assigment..for example
what is the right indentation between the row where is "throws" and the rows where is the "switch"?



Thanks...
 
Andrea Gazzarini
Ranch Hand
Posts: 125
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, but It's the first time I use the UBB Code...the problem about the indentation is only between the "throws" and the "switch" row...the "case" rows are not formatted
Thanks
 
Adam Till
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Have a look at:-
http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
note its recomended to have indentations of 8 spaces and not using tabs.
 
Aruna Raghavan
Ranch Hand
Posts: 194
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adam,
I read it as "unit of indentation is 4 spaces and tag eight spaces. The exact nature of indent ( tab vs. spaces) is unspecified'.
I decided to disable tabs and use spaces. so, I am using 4 spaces.
Aruna.
 
John Smith
Ranch Hand
Posts: 2937
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm not sure about the coding conventions of my assigment..for example
what is the right indentation between the row where is "throws" and the rows where is the "switch"?

Break after a comma.
Break before an operator.
Prefer higher-level breaks to lower-level breaks.
Align the new line with the beginning of the expression at the same level on the previous line.
If the above rules lead to confusing code or to code that's squished up against the right margin, just indent 8 spaces instead.
Therefore, your code becomes this:

Eugene.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic