jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davide Giannella <giannella.dav...@gmail.com>
Subject Re: Code style
Date Tue, 04 Mar 2014 13:11:53 GMT
On 04/03/2014 08:49, Thomas Mueller wrote:
> Sure, the exact formatting rules are a matter of personal taste. But why
> do companies such as Google *enforce* specific rules?
>
>     http://google-styleguide.googlecode.com/svn/trunk/javaguide.html
>
>
> Becase most of the time, developers *read* the code. And it's not just you
> who reads your code, but everybody else as well. Formatting rules help
> people read the code. I personally have a hard time understanding code
> that doesn't follow basic coding conventions. In fact I dislike such code.
> If you read a book, you expect certain formatting rules (identation,
> whitespace usage, and so on), and if those rules are broken, you can not
> concentrate on the content.
>
> In addition, some code conventions avoid bugs, for example the recent
> famous Apple SSL/TLS bug:
>
>     https://www.imperialviolet.org/2014/02/22/applebug.html
>
> With decent rules, and the Maven checkstyle plugin, it's easy to avoid
> such bugs.
>
> Therefore, I think we should use strict rules.
@Thomas, don't take it personally, I'm only using the Jira we're on as
an example of what I meant :)

I personally agree on code conventions and I was suggesting to use
checkstyle as it would ease our day-by-day work highlighting in time
what could be wrong and with some extra tools (Eclipse, etc) fix quickly
any formatting issues. On top there won't be any "battles" between we
use this or that as the rules in the checkstyle will say what is required.

I raised the topic as the issue I'm working with (OAK-1263) is costing
me quite some time in fixing formatting. Time that I could have spent in
developing new features. All things that if we have the maven plugin in
place it would have highlighted much earlier.

https://issues.apache.org/jira/browse/OAK-1263

I'm only trying to see if we could improve the process as I'm going
through the experience right now :)

So again I'm asking. Do we want to enforce any code conventions? If yes
we should use a tool to ease our job otherwise we should not bother at all.

For example the rules I got so far

* spaces only
* 4 spaces indentation
* spaces between statements (if (blblblala) {)
* No * import
* still some doubts on static imports vs non-static ones. Some told me
yes some told me no.

I know that for a committer this is not felt as you simply commit but if
you submit a patch then you have to go though the pain of fixing the
formatting according to "committer mood" rather than some written rules.

Peace and Love ;)
Davide



Mime
View raw message