You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Fernando Ribeiro <we...@fernandoribeiro.eti.br> on 2011/05/13 20:53:24 UTC
Constants
All,
Is there any agreement here about whether we use interfaces, classes or
enums for constants? If so, are there naming conventions that we use or
would like to use going forward?
Thanks,
Fernando
Re: Constants
Posted by Fernando Ribeiro <we...@fernandoribeiro.eti.br>.
I was giving some more thought to this and noted that, since most constants
in the Camel components are really for header and parameter names, we
wouldn't really enjoy the benefits of type safety that enums do bring.
Instead, I think we should pick either constant classes or interfaces and
start the alignment, what do you guys think?
On Tue, May 24, 2011 at 2:45 PM, Fernando Ribeiro <
webmaster@fernandoribeiro.eti.br> wrote:
> It is about type safety more than anything else, meaning you can't possibly
> pass an invalid value. One could also say it is the "proper" implementation
> of enumerations in Java 5+, but I prefer the first argument.
>
> If we choose enums, we can split header and parameter names, for example,
> in types like <ComponentPrefix>Headers <ComponentPrefix>Params (e.g:
> FreemarkerHeaders and FreemarkerParams) instead of having to diff them in
> classes/interfaces w/ prefixes like HEADER_ and PARAM_ -- I like this.
>
> What do you guys think?
>
> On Tue, May 24, 2011 at 5:28 AM, Willem Jiang <wi...@gmail.com>wrote:
>
>> If we are using enums, what kind of benefit can we get compare to use
>> class or interface ?
>>
>> +1 to align this.
>>
>> Willem
>>
>>
>> On 5/24/11 1:08 AM, Fernando Ribeiro wrote:
>>
>>> Claus, anyone?
>>>
>>> On Tue, May 17, 2011 at 4:35 PM, Fernando Ribeiro<
>>> webmaster@fernandoribeiro.eti.br> wrote:
>>>
>>> Me neither, but agree we should align this, may also use enums, as JDK
>>>> 1.4
>>>> was already dropped, what do you think, everybody?
>>>>
>>>> On Tue, May 17, 2011 at 4:30 PM, Christian Müller<
>>>> christian.mueller@gmail.com> wrote:
>>>>
>>>> We have classes and interfaces, e.g.:
>>>>>
>>>>> interface --> org.apache.camel.component.cxf.CxfConstants
>>>>> class --> org.apache.camel.component.jms.JmsConstants
>>>>>
>>>>> We should align this. At present, I don't have any preferences.
>>>>>
>>>>> Christian
>>>>>
>>>>> On Mon, May 16, 2011 at 11:20 PM, Fernando Ribeiro<
>>>>> webmaster@fernandoribeiro.eti.br> wrote:
>>>>>
>>>>> Any feedback yet? Thanks.
>>>>>>
>>>>>> On Fri, May 13, 2011 at 3:53 PM, Fernando Ribeiro<
>>>>>> webmaster@fernandoribeiro.eti.br> wrote:
>>>>>>
>>>>>> All,
>>>>>>>
>>>>>>> Is there any agreement here about whether we use interfaces, classes
>>>>>>>
>>>>>> or
>>>>>
>>>>>> enums for constants? If so, are there naming conventions that we use
>>>>>>>
>>>>>> or
>>>>>
>>>>>> would like to use going forward?
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Fernando
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>> --
>> Willem
>> ----------------------------------
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog: http://willemjiang.blogspot.com (English)
>> http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>>
>> Connect at CamelOne May 24-26
>> The Open Source Integration Conference
>> http://camelone.com
>>
>
>
Re: Constants
Posted by Fernando Ribeiro <we...@fernandoribeiro.eti.br>.
It is about type safety more than anything else, meaning you can't possibly
pass an invalid value. One could also say it is the "proper" implementation
of enumerations in Java 5+, but I prefer the first argument.
If we choose enums, we can split header and parameter names, for example, in
types like <ComponentPrefix>Headers <ComponentPrefix>Params (e.g:
FreemarkerHeaders and FreemarkerParams) instead of having to diff them in
classes/interfaces w/ prefixes like HEADER_ and PARAM_ -- I like this.
What do you guys think?
On Tue, May 24, 2011 at 5:28 AM, Willem Jiang <wi...@gmail.com>wrote:
> If we are using enums, what kind of benefit can we get compare to use class
> or interface ?
>
> +1 to align this.
>
> Willem
>
>
> On 5/24/11 1:08 AM, Fernando Ribeiro wrote:
>
>> Claus, anyone?
>>
>> On Tue, May 17, 2011 at 4:35 PM, Fernando Ribeiro<
>> webmaster@fernandoribeiro.eti.br> wrote:
>>
>> Me neither, but agree we should align this, may also use enums, as JDK
>>> 1.4
>>> was already dropped, what do you think, everybody?
>>>
>>> On Tue, May 17, 2011 at 4:30 PM, Christian Müller<
>>> christian.mueller@gmail.com> wrote:
>>>
>>> We have classes and interfaces, e.g.:
>>>>
>>>> interface --> org.apache.camel.component.cxf.CxfConstants
>>>> class --> org.apache.camel.component.jms.JmsConstants
>>>>
>>>> We should align this. At present, I don't have any preferences.
>>>>
>>>> Christian
>>>>
>>>> On Mon, May 16, 2011 at 11:20 PM, Fernando Ribeiro<
>>>> webmaster@fernandoribeiro.eti.br> wrote:
>>>>
>>>> Any feedback yet? Thanks.
>>>>>
>>>>> On Fri, May 13, 2011 at 3:53 PM, Fernando Ribeiro<
>>>>> webmaster@fernandoribeiro.eti.br> wrote:
>>>>>
>>>>> All,
>>>>>>
>>>>>> Is there any agreement here about whether we use interfaces, classes
>>>>>>
>>>>> or
>>>>
>>>>> enums for constants? If so, are there naming conventions that we use
>>>>>>
>>>>> or
>>>>
>>>>> would like to use going forward?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Fernando
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
>
> Connect at CamelOne May 24-26
> The Open Source Integration Conference
> http://camelone.com
>
Re: Constants
Posted by Willem Jiang <wi...@gmail.com>.
If we are using enums, what kind of benefit can we get compare to use
class or interface ?
+1 to align this.
Willem
On 5/24/11 1:08 AM, Fernando Ribeiro wrote:
> Claus, anyone?
>
> On Tue, May 17, 2011 at 4:35 PM, Fernando Ribeiro<
> webmaster@fernandoribeiro.eti.br> wrote:
>
>> Me neither, but agree we should align this, may also use enums, as JDK 1.4
>> was already dropped, what do you think, everybody?
>>
>> On Tue, May 17, 2011 at 4:30 PM, Christian Müller<
>> christian.mueller@gmail.com> wrote:
>>
>>> We have classes and interfaces, e.g.:
>>>
>>> interface --> org.apache.camel.component.cxf.CxfConstants
>>> class --> org.apache.camel.component.jms.JmsConstants
>>>
>>> We should align this. At present, I don't have any preferences.
>>>
>>> Christian
>>>
>>> On Mon, May 16, 2011 at 11:20 PM, Fernando Ribeiro<
>>> webmaster@fernandoribeiro.eti.br> wrote:
>>>
>>>> Any feedback yet? Thanks.
>>>>
>>>> On Fri, May 13, 2011 at 3:53 PM, Fernando Ribeiro<
>>>> webmaster@fernandoribeiro.eti.br> wrote:
>>>>
>>>>> All,
>>>>>
>>>>> Is there any agreement here about whether we use interfaces, classes
>>> or
>>>>> enums for constants? If so, are there naming conventions that we use
>>> or
>>>>> would like to use going forward?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Fernando
>>>>>
>>>>
>>>
>>
>>
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com
Re: Constants
Posted by Fernando Ribeiro <we...@fernandoribeiro.eti.br>.
Claus, anyone?
On Tue, May 17, 2011 at 4:35 PM, Fernando Ribeiro <
webmaster@fernandoribeiro.eti.br> wrote:
> Me neither, but agree we should align this, may also use enums, as JDK 1.4
> was already dropped, what do you think, everybody?
>
> On Tue, May 17, 2011 at 4:30 PM, Christian Müller <
> christian.mueller@gmail.com> wrote:
>
>> We have classes and interfaces, e.g.:
>>
>> interface --> org.apache.camel.component.cxf.CxfConstants
>> class --> org.apache.camel.component.jms.JmsConstants
>>
>> We should align this. At present, I don't have any preferences.
>>
>> Christian
>>
>> On Mon, May 16, 2011 at 11:20 PM, Fernando Ribeiro <
>> webmaster@fernandoribeiro.eti.br> wrote:
>>
>> > Any feedback yet? Thanks.
>> >
>> > On Fri, May 13, 2011 at 3:53 PM, Fernando Ribeiro <
>> > webmaster@fernandoribeiro.eti.br> wrote:
>> >
>> > > All,
>> > >
>> > > Is there any agreement here about whether we use interfaces, classes
>> or
>> > > enums for constants? If so, are there naming conventions that we use
>> or
>> > > would like to use going forward?
>> > >
>> > > Thanks,
>> > >
>> > > Fernando
>> > >
>> >
>>
>
>
Re: Constants
Posted by Fernando Ribeiro <we...@fernandoribeiro.eti.br>.
Me neither, but agree we should align this, may also use enums, as JDK 1.4
was already dropped, what do you think, everybody?
On Tue, May 17, 2011 at 4:30 PM, Christian Müller <
christian.mueller@gmail.com> wrote:
> We have classes and interfaces, e.g.:
>
> interface --> org.apache.camel.component.cxf.CxfConstants
> class --> org.apache.camel.component.jms.JmsConstants
>
> We should align this. At present, I don't have any preferences.
>
> Christian
>
> On Mon, May 16, 2011 at 11:20 PM, Fernando Ribeiro <
> webmaster@fernandoribeiro.eti.br> wrote:
>
> > Any feedback yet? Thanks.
> >
> > On Fri, May 13, 2011 at 3:53 PM, Fernando Ribeiro <
> > webmaster@fernandoribeiro.eti.br> wrote:
> >
> > > All,
> > >
> > > Is there any agreement here about whether we use interfaces, classes or
> > > enums for constants? If so, are there naming conventions that we use or
> > > would like to use going forward?
> > >
> > > Thanks,
> > >
> > > Fernando
> > >
> >
>
Re: Constants
Posted by Christian Müller <ch...@gmail.com>.
We have classes and interfaces, e.g.:
interface --> org.apache.camel.component.cxf.CxfConstants
class --> org.apache.camel.component.jms.JmsConstants
We should align this. At present, I don't have any preferences.
Christian
On Mon, May 16, 2011 at 11:20 PM, Fernando Ribeiro <
webmaster@fernandoribeiro.eti.br> wrote:
> Any feedback yet? Thanks.
>
> On Fri, May 13, 2011 at 3:53 PM, Fernando Ribeiro <
> webmaster@fernandoribeiro.eti.br> wrote:
>
> > All,
> >
> > Is there any agreement here about whether we use interfaces, classes or
> > enums for constants? If so, are there naming conventions that we use or
> > would like to use going forward?
> >
> > Thanks,
> >
> > Fernando
> >
>
Re: Constants
Posted by Fernando Ribeiro <we...@fernandoribeiro.eti.br>.
Any feedback yet? Thanks.
On Fri, May 13, 2011 at 3:53 PM, Fernando Ribeiro <
webmaster@fernandoribeiro.eti.br> wrote:
> All,
>
> Is there any agreement here about whether we use interfaces, classes or
> enums for constants? If so, are there naming conventions that we use or
> would like to use going forward?
>
> Thanks,
>
> Fernando
>