You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2012/07/23 17:09:35 UTC

[jira] [Commented] (OAK-202) Simplify the code when possible

    [ https://issues.apache.org/jira/browse/OAK-202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13420702#comment-13420702 ] 

Jukka Zitting commented on OAK-202:
-----------------------------------

As noted by Julian in the similar JCR-3396 issue, such minor changes are not always very clear-cut. What's simpler for one person might well be more complex for another.

For example, revision 1364664 removed the redundant field initialization in cases like the following:

{code}
private String value = null;
{code}

In cases like that I personally _prefer_ to have the explicit initial value in place so I know that it's not a problem if the constructor fails to initialize the field.

More generally many of such "simplifications" depend on personal taste and preference, so in general I'd leave it up to whoever actually works on a particular piece of code to decide which style to use. If people find that confusing, let's document a shared coding style beyond the currently agreed standard Java coding conventions. Until then I'm a bit annoyed by commits that simply make such stylistic changes with no other benefit.
                
> 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