You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Mladen Turk <mt...@apache.org> on 2007/05/16 20:29:14 UTC

Coding stlye guide

Hi,

Looking at MINA sources I found out that the coding style is
different from what I'm used to. Well, it's personal anyhow, but
it should be important.

Are there any rules for that?
I have noticed few:

1. After each '(' there must be a space.
    Exception is if next char is ')'
2. There must be a space before ')' except for #1
3. There must be a space after ')' unless it's a last char
4. Curly braces must be on the new line below the statement
5. Use spaces instead tabs
6. Use 4 spaces idents
7. Remove trailing spaces
8. Each for/if/else/try/catch/do/while block must have
    curly braces even for a single statement.

It would be great if there is some .indent file because
I already noticed that there are some files that are
starting to break those rules.

Regards,
Mladen.


Re: Coding stlye guide

Posted by Emmanuel Lecharny <el...@gmail.com>.
Hi,

I am not sure that MINA is still following the Directory project rules (I
just don't remember if there were a vote about it or not last year).

Anyway, here are the rules MINA used last year :

http://cwiki.apache.org/confluence/display/DIRxDEV/Coding+standards

Correct me, Trustin, if I'm wrong.

On 5/16/07, Mladen Turk <mt...@apache.org> wrote:
>
> Hi,
>
> Looking at MINA sources I found out that the coding style is
> different from what I'm used to. Well, it's personal anyhow, but
> it should be important.
>
> Are there any rules for that?
> I have noticed few:
>
> 1. After each '(' there must be a space.
>     Exception is if next char is ')'
> 2. There must be a space before ')' except for #1
> 3. There must be a space after ')' unless it's a last char
> 4. Curly braces must be on the new line below the statement
> 5. Use spaces instead tabs
> 6. Use 4 spaces idents
> 7. Remove trailing spaces
> 8. Each for/if/else/try/catch/do/while block must have
>     curly braces even for a single statement.
>
> It would be great if there is some .indent file because
> I already noticed that there are some files that are
> starting to break those rules.
>
> Regards,
> Mladen.
>
>


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: sctp support

Posted by Trustin Lee <tr...@gmail.com>.
On 5/17/07, mustaoglu serdar <sm...@yahoo.com> wrote:
>
>  Hi All,
>  Is there any plan to support SCTP protocol in MINA?

We'd like as many transports as we can within the extent the community
can manage.  SCTP is a good candidate, but we don't have enough time
yet.  You could make some contribution. :)

>  it supports currently only TCP and UDP?

We added serial port communication recently besides TCP and UDP.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

sctp support

Posted by mustaoglu serdar <sm...@yahoo.com>.
 
  Hi All, 
  Is there any plan to support SCTP protocol in MINA? it supports currently only TCP and UDP?
   
  for reference:  http://i1.dk/JavaSCTP/
   
  Thanks,
  Serdar
   

       
---------------------------------
You snooze, you lose. Get messages ASAP with AutoCheck
 in the all-new Yahoo! Mail Beta. 

Re: Coding stlye guide

Posted by Emmanuel Lecharny <el...@gmail.com>.
The link I have posted contains pointers to such files, btw.

Emmanuel

On 5/16/07, Mark Webb <el...@gmail.com> wrote:
>
> There is a way to import these rules as an xml file into Eclipse.  Not
> sure
> what everyones IDE of choice is, but I would bet that other IDE's have the
> same functionality.
>
> So should we develop a standard and then set up the configuration for
> different development environments?
>
> --
> ..Cheers
> Mark
>
> On 5/16/07, Mladen Turk <mt...@apache.org> wrote:
> >
> > Hi,
> >
> > Looking at MINA sources I found out that the coding style is
> > different from what I'm used to. Well, it's personal anyhow, but
> > it should be important.
> >
> > Are there any rules for that?
> > I have noticed few:
> >
> > 1. After each '(' there must be a space.
> >     Exception is if next char is ')'
> > 2. There must be a space before ')' except for #1
> > 3. There must be a space after ')' unless it's a last char
> > 4. Curly braces must be on the new line below the statement
> > 5. Use spaces instead tabs
> > 6. Use 4 spaces idents
> > 7. Remove trailing spaces
> > 8. Each for/if/else/try/catch/do/while block must have
> >     curly braces even for a single statement.
> >
> > It would be great if there is some .indent file because
> > I already noticed that there are some files that are
> > starting to break those rules.
> >
> > Regards,
> > Mladen.
> >
> >
>



-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: Coding stlye guide

Posted by Mark Webb <el...@gmail.com>.
There is a way to import these rules as an xml file into Eclipse.  Not sure
what everyones IDE of choice is, but I would bet that other IDE's have the
same functionality.

So should we develop a standard and then set up the configuration for
different development environments?

-- 
..Cheers
Mark

On 5/16/07, Mladen Turk <mt...@apache.org> wrote:
>
> Hi,
>
> Looking at MINA sources I found out that the coding style is
> different from what I'm used to. Well, it's personal anyhow, but
> it should be important.
>
> Are there any rules for that?
> I have noticed few:
>
> 1. After each '(' there must be a space.
>     Exception is if next char is ')'
> 2. There must be a space before ')' except for #1
> 3. There must be a space after ')' unless it's a last char
> 4. Curly braces must be on the new line below the statement
> 5. Use spaces instead tabs
> 6. Use 4 spaces idents
> 7. Remove trailing spaces
> 8. Each for/if/else/try/catch/do/while block must have
>     curly braces even for a single statement.
>
> It would be great if there is some .indent file because
> I already noticed that there are some files that are
> starting to break those rules.
>
> Regards,
> Mladen.
>
>

Re: Coding stlye guide

Posted by Niklas Therning <ni...@trillian.se>.
Mladen Turk wrote:
> Niklas Therning wrote:
>> That's one of the reasons why we made this decision IIRC. But maybe it's
>> time to reconsider? It sure would be nice to have all source code fixed
>> before we release 2.0.
>>
>
> If the decision was made to change the coding style, then IMHO
> it's better to do that sooner then later, and in batch, so that
> SVN changes can be tracked. Having multiple styles would make
> things petty confusing for contributors (like me :)
I can definitely understand the confusion. We need to coordinate though
among the developers to minimize the merging headaches that could
result. I've added an issue to JIRA. We should take care of this at
least before 2.0 is released.

-- 
Niklas Therning
www.spamdrain.net


Re: Coding stlye guide

Posted by Mladen Turk <mt...@apache.org>.
Niklas Therning wrote:
> That's one of the reasons why we made this decision IIRC. But maybe it's
> time to reconsider? It sure would be nice to have all source code fixed
> before we release 2.0.
> 

If the decision was made to change the coding style, then IMHO
it's better to do that sooner then later, and in batch, so that
SVN changes can be tracked. Having multiple styles would make
things petty confusing for contributors (like me :)

Regards,
Mladen.

Re: Coding stlye guide

Posted by Niklas Therning <ni...@trillian.se>.
Mladen Turk wrote:
> Niklas Therning wrote:
>>>
>>> It would be great if there is some .indent file because
>>> I already noticed that there are some files that are
>>> starting to break those rules.
>>>
>>
>> Please have a look here:
>> http://mina.apache.org/developer-guide.html#DeveloperGuide-CodingConvention
>>
>>
>> Back when MINA was a sub-project of the directory project we used to
>> follow the conventions used by them.
>
> Huh, but seems this template doesn't follow what's in the SVN.
> Not even close. So either it has to be updated so it reflects the
> current coding convention or marked as obsolete.
>
> Regards,
> Mladen.
>

Right, as I tried to explain we won't reformat files until we actually
need to do any changes to them (like fixing a bug or adding a feature).
That's why there still are a lot of files which look weird. There are of
course tools which take care of these things automatically (like
Ctrl+Shift+F in eclipse) but I think we would still need to do a manual
audit to make sure things look good after the automatic reformatting.
That's one of the reasons why we made this decision IIRC. But maybe it's
time to reconsider? It sure would be nice to have all source code fixed
before we release 2.0.

-- 
Niklas Therning
www.spamdrain.net


Re: Coding stlye guide

Posted by Mladen Turk <mt...@apache.org>.
Niklas Therning wrote:
>>
>> It would be great if there is some .indent file because
>> I already noticed that there are some files that are
>> starting to break those rules.
>>
> 
> Please have a look here:
> http://mina.apache.org/developer-guide.html#DeveloperGuide-CodingConvention
> 
> Back when MINA was a sub-project of the directory project we used to
> follow the conventions used by them.

Huh, but seems this template doesn't follow what's in the SVN.
Not even close. So either it has to be updated so it reflects the
current coding convention or marked as obsolete.

Regards,
Mladen.

Re: Coding stlye guide

Posted by Emmanuel Lecharny <el...@apache.org>.
Niklas Therning a écrit :

>Please have a look here:
>http://mina.apache.org/developer-guide.html#DeveloperGuide-CodingConvention
>  
>

Oh, thanks, Niklas, I didn't found it (was looking into confluence)...

>Back when MINA was a sub-project of the directory project we used to
>follow the conventions used by them. But as MINA became a top level
>project we switched to Sun's Java Coding Conventions. There is still
>code in there which haven't been reformatted yet. I think we decided to
>only do that when we're updating a file (like fixing a bug or adding
>features).
>  
>
Yes, Directory coding style is not really following Sun's coding 
convention. MINA has decided to follow sun's coding convention, and this 
is why you may find some old code whit Directory Coding Convention.

Emmanuel


Re: Coding stlye guide

Posted by Niklas Therning <ni...@trillian.se>.
Mladen Turk wrote:
> Hi,
>
> Looking at MINA sources I found out that the coding style is
> different from what I'm used to. Well, it's personal anyhow, but
> it should be important.
>
> Are there any rules for that?
> I have noticed few:
>
> 1. After each '(' there must be a space.
>    Exception is if next char is ')'
> 2. There must be a space before ')' except for #1
> 3. There must be a space after ')' unless it's a last char
> 4. Curly braces must be on the new line below the statement
> 5. Use spaces instead tabs
> 6. Use 4 spaces idents
> 7. Remove trailing spaces
> 8. Each for/if/else/try/catch/do/while block must have
>    curly braces even for a single statement.
>
> It would be great if there is some .indent file because
> I already noticed that there are some files that are
> starting to break those rules.
>
> Regards,
> Mladen.
>
>

Please have a look here:
http://mina.apache.org/developer-guide.html#DeveloperGuide-CodingConvention

Back when MINA was a sub-project of the directory project we used to
follow the conventions used by them. But as MINA became a top level
project we switched to Sun's Java Coding Conventions. There is still
code in there which haven't been reformatted yet. I think we decided to
only do that when we're updating a file (like fixing a bug or adding
features).

-- 
Niklas Therning
www.spamdrain.net