This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

code style conventions  RSS feed

 
Andy Jung
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

1. where is it best to place inner classes? At the beginning of a class where member variable declarations are placed or at the end?
2. How to wrap a code-line with "=" - Operator? The sun code style conventions says, if an operator has two operands, like +, -, * or /
then it should be done this way for example:

Since in mathematics "=" is also defined as an operator with two operands it would be like this?:



Looks strange, doesn't it?

Kind REgards,
Andy
 
Roel De Nijs
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andy,

1/ My inner classes are at the end of a class
2/ I just used 80 chars per line (so your dummy-example is on 1 line in my code)

Kind regards,
Roel
 
Andy Jung
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:Hi Andy,
2/ I just used 80 chars per line (so your dummy-example is on 1 line in my code)


Hi Roel,

ok, 2) was a bad example , I also use 80 chars per line,
but how do you break lines regarding those operators, if we assume a need of a line break?

Kind regards,
Andy
 
Roel De Nijs
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andy,

I don't do something special: just format with 80 chars per line and that's it. Eclipse takes care of the rest

Kind regards,
Roel
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!