Menu

code convention

2004-11-29
2013-04-17
  • Nicolas Chalumeau

    Do you have some preference about coding convention standard ?
    Personnaly I like the turbine one http://jakarta.apache.org/turbine/common/code-standards.html

     
    • Edouard Mercier

      Edouard Mercier - 2004-11-30

      I overread it, and it seems to me OK.

      Good think that you mention the coding convention.

      What I do not like at all is the Sun convention, which brings asymetrie (which is useless and burdersome for out symetrical minds)...

      Go for it...

      It makes me think that we should dedicate a page to the development rules...

       
    • Nicolas Chalumeau

      Ok so lets go for turbine like coding standard.

      The main advantage is that some maven plugin allow to control/correct syntaxe automaticly ie checkstyle and jalopy

       
    • Nicolas Chalumeau

      I want to change some little point to the turbine convension :
      - linelength limit to 120 characteres
      - attributs are prefix with this ie this.attr
      You can look at the checkstyle project on sourceforge if you see some modification. The xml file that declare our rule is xrn_checks.xml at the root of the project

       
    • Edouard Mercier

      Edouard Mercier - 2004-12-01

      This is a good thing to impose coding conventions, since it makes the code consistent.

      However, for myself, I prefer not to use the this.attributeName but prefix each protected/procate attribute by an underscore (_): this prevents from using the this convention.

      If you take a close look at the 'org.xrn.ant.XMLReleaseNotes' Java class, you can deduce the my conventions...

      Yes, I have seen that Maven proposes a plugin concerning the code style... For the moment, I cannot get the Maven work, but as soon as it works, I'll try it!

       
    • Nicolas Chalumeau

      I think it is something very important too so lets talk more about it. Carsten if you have some preference in it give us them.

      If you look at the http://checkstyle.sourceforge.net/config_naming.html you will see the default regexp you to validate the names.
      The majority of java use the first letter upercase to separate word (Carsten too as I see). So if you have no objection we could use this convention instead of using the underscore to separate word.

      The regexp I like to introduce are the default but with as you said the underscor to prefix member attributes ie :
      MemberName regexp : ^_[a-z][a-zA-Z0-9]*$

      If you have some difficulty to make maven work let me know I can provide you some advice ;)

       
    • Anonymous

      Anonymous - 2004-12-01

      Well, code convention is an important fact. Yes, I prefer the upper case to separate a word. Normally, I don't have special preferences. I hope my code fulfill the most convention rules.
      In general, I will keep the style I am used to because its anoying when you have to change to style every time. The project I am working for has a coding convention too. So, if I would follow each convention would be absolutly confusing.
      If there is a bad habit in my code, please tell me.

       

Log in to post a comment.