[GenABEL-dev] GenABEL project style guide

L.C. Karssen lennart at karssen.org
Mon Mar 18 09:32:17 CET 2013


Dear all,

I'd like to follow up on something Yurii wrote in the discussion on the
GenABEL tutorial:

On 03/14/2013 09:38 AM, Yurii Aulchenko wrote:
> I agree that full argument names should be preferred. I was just being
> lazy; I am trying to improve. If other people come up with things
> which are "not in good style" we should probably think of a "good
> style rules" document and then ask people to please to follow them.
>

I completely agree with Yurii. In fact, I think we should not only set
guidelines for the style of the code in the tutorial, but more generally
for all R and C/C++ code in the GenABEL project.

What about setting up a shared editing environment (e.g. on
piratepad.net) to work on an initial draft of these quidelines? Once
they are more or less fixed we can move the document to SVN as part of
the developer documentation.

From my experience over the last few years I think the following points
are the most commonly occurring ones (for any language) that need
harmonisation:
- comma's should be followed by a space
- operators (= + - * etc.) should be surrounded by a space (and in R the
<- operator too)
- a file should always have a newline at the end
- don't use tabs (as everyone seems to have a different setting for the
tab stop): use spaces. How many spaces is up for debate. Of course
Makefiles are exempt from this rule as tabs are mandatory
- style of brackets: is the opening bracket on the same line as the name
of the loop/function or on a new line on its own? (e.g. K&R, Allman or
bsd style)
- always use {} in if clauses/for loops (even if there is only one
statement in the clause/loop
- lines should not be longer than 80 characters (you may call me old
fashioned ;-))

I think most of these can be set as options in modern development
environment. I'm not an Eclipse user, like many of you, but in Emacs
these can easily be set in your .emacs file. We should also provide info
on how to implement these settings in various DEs in our guidelines
document so that new developers can easily use them.


Lennart.
-- 
-----------------------------------------------------------------
L.C. Karssen
Utrecht
The Netherlands

lennart at karssen.org
http://blog.karssen.org

Stuur mij aub geen Word of Powerpoint bestanden!
Zie http://www.gnu.org/philosophy/no-word-attachments.nl.html
------------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: OpenPGP digital signature
URL: <http://lists.r-forge.r-project.org/pipermail/genabel-devel/attachments/20130318/633418a4/attachment.sig>


More information about the genabel-devel mailing list