You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Dan Haywood <da...@haywood-associates.co.uk> on 2018/12/28 10:54:32 UTC

v2 - explicit vs implicit annotations

Hi folks,

... and happy holidays!

We currently have the configuration property
"isis.reflector.explicitAnnotations.action" which if specified
requires @Action to be added as an annotation for all public methods that
don't represent properties/collections or supporting methods.  If this is
enabled then there's generally no need to annotate public methods that
aren't meant to be in the metamodel with the @Programmatic annotation.

Andi and I have just been discussing this (off-list) and wondering if we
should extend this in v2.  Our idea is maybe to allow this to be specified
at the class level, and to also have three levels rather than two:

- explicit : all properties, collections and actions must be annotated
- actions : actions must be annotated, but properties and collections need
not.  This is the behavior if the above configuration property is specified.
- implicit : no annotations are required.  This is the current default

So, we were thinking to add a value to @DomainObject, eg

@DomainObject(metamodelDiscoveryStrategy = EXPLICIT | ACTIONS | IMPLICIT |
AS_CONFIGURED)

where "AS_CONFIGURED" would read a new configuration property that would
take these three values (replacing the existing
"isis.reflector.explicitAnnotations.action".

Two questions:

1. is the idea of a new level to explicitly annotate everything (properties
and collections as well as actions) useful ?
2. is there a need to configure this on a class-by-class basis, or is a
global configuration property sufficient?

Thx
Dan

Re: v2 - explicit vs implicit annotations

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
I've raised https://issues.apache.org/jira/browse/ISIS-2064 for this
possible enhancement.


On Sun, 30 Dec 2018 at 09:11, Dan Haywood <da...@haywood-associates.co.uk>
wrote:

> Hi Jayesh,
> thanks for your thoughts.
>
> With regard to XML vs annotations, you might have noticed that the
> .layout.xml file is equivalent to (and overrides) the @XxxLayout
> annotations (@DomainObjectLayout, @PropertyLayout, @CollectionLayout,
> @ActionLayout).  However, there is very deliberately *no* ability to use
> XML for the non-layout annotations (@DomainObject, @Property, @Collection,
> @Action etc).
>
> I tend to think of the metadata as relating either to the presentation
> layer (ie the layout annotations) or intrinsic to the domain layer (the
> non-layout annotations). And, obviously, the jdo annotations relate to the
> persistence layer.  So, the rule that we have is that the presentation
> layer metadata can also be expressed in XML (so it can be dynamically
> reloaded), but the domain layer metadata cannot because (unless using
> jrebel or similar) a change to the domain would likely require a restart of
> the application anyway)
>
> Hope that makes sense.
>
> Cheers,
> Dan
>
>
> On Fri, 28 Dec 2018 at 12:56, Jayesh Prajapati <ja...@gmail.com>
> wrote:
>
>> Hi Dan
>>
>> I agree with both the options and would also be great if these can be
>> configurable at xml file level.
>>
>> Having said this, based on my experience too many configurations are not
>> good mainly because ...
>> ... 1) Annotation guide is for advance users, meaning newbees will find it
>> difficult
>> ... 2) During deployment extreme cares are required because usually
>> deployment are done by technical operations who are not familiar with such
>> settings
>>
>> I will share more thoughts about such settings/config management at UI
>> level.
>>
>>
>> On Fri, Dec 28, 2018, 17:18 Dan Haywood <dan@haywood-associates.co.uk
>> wrote:
>>
>> > Submodules - yes, that's a good point, I hadn't considered that at all.
>> >
>> > I suppose it also makes sense to be able to specify using the Module
>> > interface as well, to create some sort of search hierarchy : class ->
>> > module -> global.
>> >
>> > But perhaps one step at a time.
>> >
>> > Thx!
>> > Dan
>> >
>> > On Fri, 28 Dec 2018 at 11:27, Patrick Pliessnig <p....@gmx.net>
>> > wrote:
>> >
>> > > Hi Dan
>> > >
>> > > In a reuse scenario a local configuration of the annotation property
>> is
>> > > certainly useful. I guess that if you want to integrate an existing
>> > > subdomain module into a destination application, a configuration
>> > > property at the class or module level could ease the job.
>> > >
>> > > Patrick
>> > >
>> > >
>> > > Am 28.12.2018 um 11:54 schrieb Dan Haywood:
>> > > > Hi folks,
>> > > >
>> > > > ... and happy holidays!
>> > > >
>> > > > We currently have the configuration property
>> > > > "isis.reflector.explicitAnnotations.action" which if specified
>> > > > requires @Action to be added as an annotation for all public methods
>> > that
>> > > > don't represent properties/collections or supporting methods.  If
>> this
>> > is
>> > > > enabled then there's generally no need to annotate public methods
>> that
>> > > > aren't meant to be in the metamodel with the @Programmatic
>> annotation.
>> > > >
>> > > > Andi and I have just been discussing this (off-list) and wondering
>> if
>> > we
>> > > > should extend this in v2.  Our idea is maybe to allow this to be
>> > > specified
>> > > > at the class level, and to also have three levels rather than two:
>> > > >
>> > > > - explicit : all properties, collections and actions must be
>> annotated
>> > > > - actions : actions must be annotated, but properties and
>> collections
>> > > need
>> > > > not.  This is the behavior if the above configuration property is
>> > > specified.
>> > > > - implicit : no annotations are required.  This is the current
>> default
>> > > >
>> > > > So, we were thinking to add a value to @DomainObject, eg
>> > > >
>> > > > @DomainObject(metamodelDiscoveryStrategy = EXPLICIT | ACTIONS |
>> > IMPLICIT
>> > > |
>> > > > AS_CONFIGURED)
>> > > >
>> > > > where "AS_CONFIGURED" would read a new configuration property that
>> > would
>> > > > take these three values (replacing the existing
>> > > > "isis.reflector.explicitAnnotations.action".
>> > > >
>> > > > Two questions:
>> > > >
>> > > > 1. is the idea of a new level to explicitly annotate everything
>> > > (properties
>> > > > and collections as well as actions) useful ?
>> > > > 2. is there a need to configure this on a class-by-class basis, or
>> is a
>> > > > global configuration property sufficient?
>> > > >
>> > > > Thx
>> > > > Dan
>> > > >
>> > >
>> > >
>> >
>>
>

Re: v2 - explicit vs implicit annotations

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Jayesh,
thanks for your thoughts.

With regard to XML vs annotations, you might have noticed that the
.layout.xml file is equivalent to (and overrides) the @XxxLayout
annotations (@DomainObjectLayout, @PropertyLayout, @CollectionLayout,
@ActionLayout).  However, there is very deliberately *no* ability to use
XML for the non-layout annotations (@DomainObject, @Property, @Collection,
@Action etc).

I tend to think of the metadata as relating either to the presentation
layer (ie the layout annotations) or intrinsic to the domain layer (the
non-layout annotations). And, obviously, the jdo annotations relate to the
persistence layer.  So, the rule that we have is that the presentation
layer metadata can also be expressed in XML (so it can be dynamically
reloaded), but the domain layer metadata cannot because (unless using
jrebel or similar) a change to the domain would likely require a restart of
the application anyway)

Hope that makes sense.

Cheers,
Dan


On Fri, 28 Dec 2018 at 12:56, Jayesh Prajapati <ja...@gmail.com> wrote:

> Hi Dan
>
> I agree with both the options and would also be great if these can be
> configurable at xml file level.
>
> Having said this, based on my experience too many configurations are not
> good mainly because ...
> ... 1) Annotation guide is for advance users, meaning newbees will find it
> difficult
> ... 2) During deployment extreme cares are required because usually
> deployment are done by technical operations who are not familiar with such
> settings
>
> I will share more thoughts about such settings/config management at UI
> level.
>
>
> On Fri, Dec 28, 2018, 17:18 Dan Haywood <dan@haywood-associates.co.uk
> wrote:
>
> > Submodules - yes, that's a good point, I hadn't considered that at all.
> >
> > I suppose it also makes sense to be able to specify using the Module
> > interface as well, to create some sort of search hierarchy : class ->
> > module -> global.
> >
> > But perhaps one step at a time.
> >
> > Thx!
> > Dan
> >
> > On Fri, 28 Dec 2018 at 11:27, Patrick Pliessnig <p....@gmx.net>
> > wrote:
> >
> > > Hi Dan
> > >
> > > In a reuse scenario a local configuration of the annotation property is
> > > certainly useful. I guess that if you want to integrate an existing
> > > subdomain module into a destination application, a configuration
> > > property at the class or module level could ease the job.
> > >
> > > Patrick
> > >
> > >
> > > Am 28.12.2018 um 11:54 schrieb Dan Haywood:
> > > > Hi folks,
> > > >
> > > > ... and happy holidays!
> > > >
> > > > We currently have the configuration property
> > > > "isis.reflector.explicitAnnotations.action" which if specified
> > > > requires @Action to be added as an annotation for all public methods
> > that
> > > > don't represent properties/collections or supporting methods.  If
> this
> > is
> > > > enabled then there's generally no need to annotate public methods
> that
> > > > aren't meant to be in the metamodel with the @Programmatic
> annotation.
> > > >
> > > > Andi and I have just been discussing this (off-list) and wondering if
> > we
> > > > should extend this in v2.  Our idea is maybe to allow this to be
> > > specified
> > > > at the class level, and to also have three levels rather than two:
> > > >
> > > > - explicit : all properties, collections and actions must be
> annotated
> > > > - actions : actions must be annotated, but properties and collections
> > > need
> > > > not.  This is the behavior if the above configuration property is
> > > specified.
> > > > - implicit : no annotations are required.  This is the current
> default
> > > >
> > > > So, we were thinking to add a value to @DomainObject, eg
> > > >
> > > > @DomainObject(metamodelDiscoveryStrategy = EXPLICIT | ACTIONS |
> > IMPLICIT
> > > |
> > > > AS_CONFIGURED)
> > > >
> > > > where "AS_CONFIGURED" would read a new configuration property that
> > would
> > > > take these three values (replacing the existing
> > > > "isis.reflector.explicitAnnotations.action".
> > > >
> > > > Two questions:
> > > >
> > > > 1. is the idea of a new level to explicitly annotate everything
> > > (properties
> > > > and collections as well as actions) useful ?
> > > > 2. is there a need to configure this on a class-by-class basis, or
> is a
> > > > global configuration property sufficient?
> > > >
> > > > Thx
> > > > Dan
> > > >
> > >
> > >
> >
>

Re: v2 - explicit vs implicit annotations

Posted by Jayesh Prajapati <ja...@gmail.com>.
Hi Dan

I agree with both the options and would also be great if these can be
configurable at xml file level.

Having said this, based on my experience too many configurations are not
good mainly because ...
... 1) Annotation guide is for advance users, meaning newbees will find it
difficult
... 2) During deployment extreme cares are required because usually
deployment are done by technical operations who are not familiar with such
settings

I will share more thoughts about such settings/config management at UI
level.


On Fri, Dec 28, 2018, 17:18 Dan Haywood <dan@haywood-associates.co.uk wrote:

> Submodules - yes, that's a good point, I hadn't considered that at all.
>
> I suppose it also makes sense to be able to specify using the Module
> interface as well, to create some sort of search hierarchy : class ->
> module -> global.
>
> But perhaps one step at a time.
>
> Thx!
> Dan
>
> On Fri, 28 Dec 2018 at 11:27, Patrick Pliessnig <p....@gmx.net>
> wrote:
>
> > Hi Dan
> >
> > In a reuse scenario a local configuration of the annotation property is
> > certainly useful. I guess that if you want to integrate an existing
> > subdomain module into a destination application, a configuration
> > property at the class or module level could ease the job.
> >
> > Patrick
> >
> >
> > Am 28.12.2018 um 11:54 schrieb Dan Haywood:
> > > Hi folks,
> > >
> > > ... and happy holidays!
> > >
> > > We currently have the configuration property
> > > "isis.reflector.explicitAnnotations.action" which if specified
> > > requires @Action to be added as an annotation for all public methods
> that
> > > don't represent properties/collections or supporting methods.  If this
> is
> > > enabled then there's generally no need to annotate public methods that
> > > aren't meant to be in the metamodel with the @Programmatic annotation.
> > >
> > > Andi and I have just been discussing this (off-list) and wondering if
> we
> > > should extend this in v2.  Our idea is maybe to allow this to be
> > specified
> > > at the class level, and to also have three levels rather than two:
> > >
> > > - explicit : all properties, collections and actions must be annotated
> > > - actions : actions must be annotated, but properties and collections
> > need
> > > not.  This is the behavior if the above configuration property is
> > specified.
> > > - implicit : no annotations are required.  This is the current default
> > >
> > > So, we were thinking to add a value to @DomainObject, eg
> > >
> > > @DomainObject(metamodelDiscoveryStrategy = EXPLICIT | ACTIONS |
> IMPLICIT
> > |
> > > AS_CONFIGURED)
> > >
> > > where "AS_CONFIGURED" would read a new configuration property that
> would
> > > take these three values (replacing the existing
> > > "isis.reflector.explicitAnnotations.action".
> > >
> > > Two questions:
> > >
> > > 1. is the idea of a new level to explicitly annotate everything
> > (properties
> > > and collections as well as actions) useful ?
> > > 2. is there a need to configure this on a class-by-class basis, or is a
> > > global configuration property sufficient?
> > >
> > > Thx
> > > Dan
> > >
> >
> >
>

Re: v2 - explicit vs implicit annotations

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Submodules - yes, that's a good point, I hadn't considered that at all.

I suppose it also makes sense to be able to specify using the Module
interface as well, to create some sort of search hierarchy : class ->
module -> global.

But perhaps one step at a time.

Thx!
Dan

On Fri, 28 Dec 2018 at 11:27, Patrick Pliessnig <p....@gmx.net> wrote:

> Hi Dan
>
> In a reuse scenario a local configuration of the annotation property is
> certainly useful. I guess that if you want to integrate an existing
> subdomain module into a destination application, a configuration
> property at the class or module level could ease the job.
>
> Patrick
>
>
> Am 28.12.2018 um 11:54 schrieb Dan Haywood:
> > Hi folks,
> >
> > ... and happy holidays!
> >
> > We currently have the configuration property
> > "isis.reflector.explicitAnnotations.action" which if specified
> > requires @Action to be added as an annotation for all public methods that
> > don't represent properties/collections or supporting methods.  If this is
> > enabled then there's generally no need to annotate public methods that
> > aren't meant to be in the metamodel with the @Programmatic annotation.
> >
> > Andi and I have just been discussing this (off-list) and wondering if we
> > should extend this in v2.  Our idea is maybe to allow this to be
> specified
> > at the class level, and to also have three levels rather than two:
> >
> > - explicit : all properties, collections and actions must be annotated
> > - actions : actions must be annotated, but properties and collections
> need
> > not.  This is the behavior if the above configuration property is
> specified.
> > - implicit : no annotations are required.  This is the current default
> >
> > So, we were thinking to add a value to @DomainObject, eg
> >
> > @DomainObject(metamodelDiscoveryStrategy = EXPLICIT | ACTIONS | IMPLICIT
> |
> > AS_CONFIGURED)
> >
> > where "AS_CONFIGURED" would read a new configuration property that would
> > take these three values (replacing the existing
> > "isis.reflector.explicitAnnotations.action".
> >
> > Two questions:
> >
> > 1. is the idea of a new level to explicitly annotate everything
> (properties
> > and collections as well as actions) useful ?
> > 2. is there a need to configure this on a class-by-class basis, or is a
> > global configuration property sufficient?
> >
> > Thx
> > Dan
> >
>
>

Re: v2 - explicit vs implicit annotations

Posted by Patrick Pliessnig <p....@gmx.net>.
Hi Dan

In a reuse scenario a local configuration of the annotation property is 
certainly useful. I guess that if you want to integrate an existing 
subdomain module into a destination application, a configuration 
property at the class or module level could ease the job.

Patrick


Am 28.12.2018 um 11:54 schrieb Dan Haywood:
> Hi folks,
>
> ... and happy holidays!
>
> We currently have the configuration property
> "isis.reflector.explicitAnnotations.action" which if specified
> requires @Action to be added as an annotation for all public methods that
> don't represent properties/collections or supporting methods.  If this is
> enabled then there's generally no need to annotate public methods that
> aren't meant to be in the metamodel with the @Programmatic annotation.
>
> Andi and I have just been discussing this (off-list) and wondering if we
> should extend this in v2.  Our idea is maybe to allow this to be specified
> at the class level, and to also have three levels rather than two:
>
> - explicit : all properties, collections and actions must be annotated
> - actions : actions must be annotated, but properties and collections need
> not.  This is the behavior if the above configuration property is specified.
> - implicit : no annotations are required.  This is the current default
>
> So, we were thinking to add a value to @DomainObject, eg
>
> @DomainObject(metamodelDiscoveryStrategy = EXPLICIT | ACTIONS | IMPLICIT |
> AS_CONFIGURED)
>
> where "AS_CONFIGURED" would read a new configuration property that would
> take these three values (replacing the existing
> "isis.reflector.explicitAnnotations.action".
>
> Two questions:
>
> 1. is the idea of a new level to explicitly annotate everything (properties
> and collections as well as actions) useful ?
> 2. is there a need to configure this on a class-by-class basis, or is a
> global configuration property sufficient?
>
> Thx
> Dan
>