[
https://issues.apache.org/jira/browse/OAK-202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13421246#comment-13421246
]
Thomas Mueller commented on OAK-202:
------------------------------------
I agree in many cases it's matter of taste, and where it's a matter of taste I
agree it should be left to the person working on that code. I made this issue
for code I'm working on or feel responsible for.
As a general rule, I think source code should be as simple as possible, to make
it easier to for the reader. That's why I personally like to avoid really
pointless Javadocs. For the same reason, I prefer if source code is formatted
consistently (position of the "}" for example). I think there should be some
minimum rules about such things, for example the "Code Conventions for the Java
Programming Language" at
http://www.oracle.com/technetwork/java/codeconv-138413.html - plus some of our
own rules such as using spaces instead of tabs.
There are cases where formatting can avoid bugs, for example even single line
"if" and "while" blocks should have "{}". Immutability helps to avoid bugs, so
when possible I make fields final (but for variables and parameters I think it
hurts readability more than it helps), and make methods static when possible.
Another example is using @Override. Most of that can be checked automatically,
for example using CheckStyle or FindBugs. If we have a shared set of CheckStyle
rules then we could avoid long discussions about that.
> Simplify the code when possible
> -------------------------------
>
> Key: OAK-202
> URL: https://issues.apache.org/jira/browse/OAK-202
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Reporter: Thomas Mueller
> Priority: Minor
>
> Sometimes it's possible to simplify the code, for example:
> - making methods static when possible, so a reader knows the method doesn't
> change the state of an object
> - the "else" is unnecessary if the "if" block always returns
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira