You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by Dan Haywood <da...@haywood-associates.co.uk> on 2012/10/03 09:29:55 UTC
A DSL for Apache Isis programming?
Dunno if anyone here is into DSLs, but it seems to me that the Apache Isis
programming conventions [1] could be encapsulated quite nicely using a DSL.
And if were going to do this (which I'm not, or at least, not yet), then I
think I'd start by checking out Eclipse XText [2].
Does this interest anyone? For a bit of fun, if nothing else.
Cheers
Dan
[1] http://incubator.apache.org/isis/IsisCheatSheet.pdf
[2] http://www.eclipse.org/Xtext/
Re: A DSL for Apache Isis programming?
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 3 October 2012 15:03, Minto van der Sluis <mi...@xup.nl> wrote:
> Hi,
>
> Graphical DSL's sounds very interesting. However I mostly prefer textual
> representations since it allows me to easily diff 2 files/versions.
>
>
Yeah, agreed. Although I only got interested in Naked Objects off the back
of working with TogetherJ [1] (remember that?!), these days I'm of the view
that diagrams are good for communication, but aren't very good as managed
software artifacts. Hence, a tool should be good at visualizing existing
code, (eg Structure101 [2]), but not much more.
Dan
[1]
http://www.amazon.co.uk/Better-Software-Faster-Coad-Carmichael/dp/0130087521
[2] http://structure101.com/
Re: A DSL for Apache Isis programming?
Posted by Minto van der Sluis <mi...@xup.nl>.
Hi,
Graphical DSL's sounds very interesting. However I mostly prefer textual
representations since it allows me to easily diff 2 files/versions.
Regards,
Minto
Op 3-10-2012 15:03, Giedrius Graževičius schreef:
> Visual editor (ex. Eclipse GMF based) sounds fun as well.
>
> Giedrius.
>
Re: A DSL for Apache Isis programming?
Posted by Giedrius Graževičius <me...@inightmare.org>.
Visual editor (ex. Eclipse GMF based) sounds fun as well.
Giedrius.
Re: A DSL for Apache Isis programming?
Posted by Adam Howard <ho...@gmail.com>.
I haven't looked at it in a while but the syntax here reminds me of
Sculptor[1]. Sculptor is a DSL for DDD code generation. Maybe some ideas
can be gleaned by looking at their website.
Adam
[1] http://fornax.itemis.de/confluence/display/fornax/Sculptor+(CSC)
On Fri, Oct 5, 2012 at 10:55 AM, Dan Haywood
<da...@haywood-associates.co.uk>wrote:
> Hi Razie,
>
> On 5 October 2012 13:39, Razvan Cojocaru <pu...@razie.com> wrote:
>
> > Let me have a whack at it - your example reminds me of something I was
> > going
> > to try for a while now (OSS/J common business entities specifications) in
> > the OSS/J Common API
> > http://www.tmforum.org/OlderAPIVersions/4676/home.html
> >
> >
> That would be great, look forward to seeing what you come up with!
>
> Cheers
> Dan
>
>
> Cheers,
> > Razie
> >
>
Re: A DSL for Apache Isis programming?
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Razie,
On 5 October 2012 13:39, Razvan Cojocaru <pu...@razie.com> wrote:
> Let me have a whack at it - your example reminds me of something I was
> going
> to try for a while now (OSS/J common business entities specifications) in
> the OSS/J Common API
> http://www.tmforum.org/OlderAPIVersions/4676/home.html
>
>
That would be great, look forward to seeing what you come up with!
Cheers
Dan
Cheers,
> Razie
>
RE: A DSL for Apache Isis programming?
Posted by Razvan Cojocaru <pu...@razie.com>.
Let me have a whack at it - your example reminds me of something I was going
to try for a while now (OSS/J common business entities specifications) in
the OSS/J Common API http://www.tmforum.org/OlderAPIVersions/4676/home.html
Cheers,
Razie
-----Original Message-----
From: Dan Haywood [mailto:dan@haywood-associates.co.uk]
Sent: October-05-12 2:37 AM
To: isis-dev@incubator.apache.org
Subject: Re: A DSL for Apache Isis programming?
Hi Razvan,
On 4 October 2012 15:42, Razvan Cojocaru <pu...@razie.com> wrote:
> XText is a great external DSL in Eclipse - have you considered an
> internal
> DSL: Scala? Many editors with content assist in all popular
> environments, online etc...
>
> Here's an example ...
>
Thanks for the suggestion; Scala in general is something that I'd like Isis
to support (there is some support for Groovy already), but I hadn't twigged
(or had forgotten) about the internal DSL facility of Scala.
This whole area is likely to be only of niche interest (ie not really
strategic to Isis as a framework); but I do imagine it'll probably be quite
fun just to play with.
Dan
>
> Cheers,
> Razie
>
> -----Original Message-----
> From: Dan Haywood [mailto:dan@haywood-associates.co.uk]
> Sent: October-04-12 3:26 AM
> To: isis-dev@incubator.apache.org
> Subject: Re: A DSL for Apache Isis programming?
>
> On 3 October 2012 15:08, Minto van der Sluis <mi...@xup.nl> wrote:
>
> > Hi Dan,
> >
> > If Xtext is a class then XCore is an instance. In fact Xcore is
> > probably implemented using Xtext.
> >
>
> Yeah, that's what I kinda guessed.
>
>
> >
> > For Isis you can create a whole new DSL unknown to others or you can
> > reuse existing DSL's like XCore to populate the meta model.
> >
>
>
>
>
> >
> > Another interesting project to have a look at is Mod4j -
> > http://www.mod4j.org/
> >
> >
> I see that mod4j builds on top of XText. But it's code generation of
> the various layers of the architecture is a solution to a problem that
> the naked objects pattern already solves (we just do that gumph at
> runtime, not compile-time).
>
> And, as you say, it looks like it might have died as a project.
>
> So... still think that XText is the place to start with this.
>
> Thx for the discussion on this; interesting!
>
> Dan
>
>
Re: A DSL for Apache Isis programming?
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Razvan,
On 4 October 2012 15:42, Razvan Cojocaru <pu...@razie.com> wrote:
> XText is a great external DSL in Eclipse - have you considered an internal
> DSL: Scala? Many editors with content assist in all popular environments,
> online etc...
>
> Here's an example ...
>
Thanks for the suggestion; Scala in general is something that I'd like Isis
to support (there is some support for Groovy already), but I hadn't twigged
(or had forgotten) about the internal DSL facility of Scala.
This whole area is likely to be only of niche interest (ie not really
strategic to Isis as a framework); but I do imagine it'll probably be quite
fun just to play with.
Dan
>
> Cheers,
> Razie
>
> -----Original Message-----
> From: Dan Haywood [mailto:dan@haywood-associates.co.uk]
> Sent: October-04-12 3:26 AM
> To: isis-dev@incubator.apache.org
> Subject: Re: A DSL for Apache Isis programming?
>
> On 3 October 2012 15:08, Minto van der Sluis <mi...@xup.nl> wrote:
>
> > Hi Dan,
> >
> > If Xtext is a class then XCore is an instance. In fact Xcore is
> > probably implemented using Xtext.
> >
>
> Yeah, that's what I kinda guessed.
>
>
> >
> > For Isis you can create a whole new DSL unknown to others or you can
> > reuse existing DSL's like XCore to populate the meta model.
> >
>
>
>
>
> >
> > Another interesting project to have a look at is Mod4j -
> > http://www.mod4j.org/
> >
> >
> I see that mod4j builds on top of XText. But it's code generation of the
> various layers of the architecture is a solution to a problem that the
> naked
> objects pattern already solves (we just do that gumph at runtime, not
> compile-time).
>
> And, as you say, it looks like it might have died as a project.
>
> So... still think that XText is the place to start with this.
>
> Thx for the discussion on this; interesting!
>
> Dan
>
>
RE: A DSL for Apache Isis programming?
Posted by Razvan Cojocaru <pu...@razie.com>.
XText is a great external DSL in Eclipse - have you considered an internal
DSL: Scala? Many editors with content assist in all popular environments,
online etc...
Here's an example of a DSL in scala: http://squeryl.org/introduction.html or
the standard unit test framework: http://scalatest.org/
Extremely Java friendly too, since you can mix Java and Scala code, use any
Java class from Scala code and vice-versa etc.
Cheers,
Razie
-----Original Message-----
From: Dan Haywood [mailto:dan@haywood-associates.co.uk]
Sent: October-04-12 3:26 AM
To: isis-dev@incubator.apache.org
Subject: Re: A DSL for Apache Isis programming?
On 3 October 2012 15:08, Minto van der Sluis <mi...@xup.nl> wrote:
> Hi Dan,
>
> If Xtext is a class then XCore is an instance. In fact Xcore is
> probably implemented using Xtext.
>
Yeah, that's what I kinda guessed.
>
> For Isis you can create a whole new DSL unknown to others or you can
> reuse existing DSL's like XCore to populate the meta model.
>
>
> Another interesting project to have a look at is Mod4j -
> http://www.mod4j.org/
>
>
I see that mod4j builds on top of XText. But it's code generation of the
various layers of the architecture is a solution to a problem that the naked
objects pattern already solves (we just do that gumph at runtime, not
compile-time).
And, as you say, it looks like it might have died as a project.
So... still think that XText is the place to start with this.
Thx for the discussion on this; interesting!
Dan
Re: A DSL for Apache Isis programming?
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 3 October 2012 15:08, Minto van der Sluis <mi...@xup.nl> wrote:
> Hi Dan,
>
> If Xtext is a class then XCore is an instance. In fact Xcore is probably
> implemented using Xtext.
>
Yeah, that's what I kinda guessed.
>
> For Isis you can create a whole new DSL unknown to others or you can
> reuse existing DSL's like XCore to populate the meta model.
>
>
> Another interesting project to have a look at is Mod4j -
> http://www.mod4j.org/
>
>
I see that mod4j builds on top of XText. But it's code generation of the
various layers of the architecture is a solution to a problem that the
naked objects pattern already solves (we just do that gumph at runtime, not
compile-time).
And, as you say, it looks like it might have died as a project.
So... still think that XText is the place to start with this.
Thx for the discussion on this; interesting!
Dan
Re: A DSL for Apache Isis programming?
Posted by Minto van der Sluis <mi...@xup.nl>.
Hi Dan,
If Xtext is a class then XCore is an instance. In fact Xcore is probably
implemented using Xtext.
For Isis you can create a whole new DSL unknown to others or you can
reuse existing DSL's like XCore to populate the meta model.
Another interesting project to have a look at is Mod4j -
http://www.mod4j.org/
Sadly that project sort of died. But still the concepts are interesting.
Just some food for thought.
Regards,
Minto
Op 3-10-2012 14:15, Dan Haywood schreef:
> Had a quick skim... I think XText looks more flexible. XCore seems to be a
> pre-baked language, whereas XText we could invent our own to some extent.
>
> They do look like close cousins, though.
>
> Dan
>
> On 3 October 2012 10:41, <mi...@xup.nl> wrote:
>
>> Hi Dan,
>>
>> I am a bit into DSL's and have played around with XText.
>>
>> Another interesting option might be XCore - http://wiki.eclipse.org/Xcore
>>
>> Regards,
>>
>> Minto
>>
>>
>>
>> Quoting Dan Haywood <da...@haywood-associates.co.uk>**:
>>
>> Dunno if anyone here is into DSLs, but it seems to me that the Apache Isis
>>> programming conventions [1] could be encapsulated quite nicely using a
>>> DSL.
>>> And if were going to do this (which I'm not, or at least, not yet), then
>>> I
>>> think I'd start by checking out Eclipse XText [2].
>>>
>>> Does this interest anyone? For a bit of fun, if nothing else.
>>>
>>> Cheers
>>> Dan
>>>
>>> [1] http://incubator.apache.org/**isis/IsisCheatSheet.pdf<http://incubator.apache.org/isis/IsisCheatSheet.pdf>
>>> [2] http://www.eclipse.org/Xtext/
>>>
>>>
>>
>
--
ir. ing. Minto van der Sluis
Software innovator / renovator
Xup BV
Mobiel: +31 (0) 626 014541
Re: A DSL for Apache Isis programming?
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 5 October 2012 12:13, Minto van der Sluis <mi...@xup.nl> wrote:
>
> Can you give an example of what you think this DSL should look like?
>
>
Off the top of my head, I've just come up with the following....
Comments welcome!
* For entities:*
@... // annotations here
entity Customer {
...
ProductRepository products;
OrderRepository orders;
}
where:
- the products, orders imply an instance variable and a setter to allow
services to be injected into
- DomainObjectContainer container is provided automatically as a field
For entity properties:
entity Customer {
@ ... // annotations here
property String firstName {
set;
modify { ... }
clear { }
default { ... }
choices { ... }
hide { ... }
disable { ... }
validate { ... }
}
}
where
- property is a keyword
- String firstName
- implies the instance variable and the getter
- annotations can be specified, apply to the getter
- set;
- is optional,
- if present implies the setter (and so is a non-derived property)
- syntax borrowed from C#
- modify { ... }
- is optional
- if present, implies the modifyXxx(String value) method
- 'value' would be an implicitly available locally scoped parameter
- clear { ... }
- is optional
- if present, implies the void clearXxx() method
- default { ... }
- is optional
- if present, implies the String defaultXxx() method
- choices { ... }
- is optional
- if present, implies the List<String> choicesXxx() method
- hide { ... }
- is optional
- if present, implies the boolean clearXxx() method
- disable { ... }
- is optional
- if present, implies the String disableXxx() method
- validate { ... }
- is optional
- if present, implies the String validateXxx(String value) method
- 'value' would be an implicitly available locally scoped parameter
similarly for entity collections:
entity Customer {
@ ... // annotations here
collection List<Order> orders {
addTo { ... }
removeFrom { }
hide { ... }
disable { ... }
validateAddTo { ... }
validateRemoveFrom { ... }
}
}
where
- collection is a keyword
- otherwise similarly as properties
and similarly for entity actions:
entity Customer {
@... // annotations here
action Order placeOrder(
Product product {
default { }
choices { }
validate { }
},
int quantity {
default { }
choices { }
validate { }
}
) {
body { ... }
hide { ... }
disable { ... }
validate { ... }
}
}
where
- the name of the parameter would imply @Named(...)
- the default, choices, validate for the parameters apply to that parameter
- imply corresponding defaultNXxx(), choicesNXxx, validateNXxx()
- where N = parameter number
- body { ... }
- is the action body, with the parameters defined
- hide, disable
- similarly
- validate (at action level)
- corresponds to validateXxx(...)
- to validate the set of arguments rather than an individual parameter
Any members that do not follow the above rules are just copied over "as-is"
into Java.
~~~~~~~~~~~~
For values:
value FractionalNumber {
int numerator;
int denominator;
}
is basically the same as Lombok @Data
requires information in @ValueSemanticsProvider to be specified (somehow,
not sure exactly how)
~~~~~~~~~~~~
For services/repositories:
service ProductRepository {
}
where:
- any services are injected into as for entities
- DomainObjectContainer container is provided for free, again as for
entities
- actions as for entities
- properties and collections are disallowed
Re: A DSL for Apache Isis programming?
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 5 October 2012 12:13, Minto van der Sluis <mi...@xup.nl> wrote:
>
> Can you give an example of what you think this DSL should look like?
>
>
Off the top of my head, I've just come up with the following....
Comments welcome!
* For entities:*
@... // annotations here
entity Customer {
...
ProductRepository products;
OrderRepository orders;
}
where:
- the products, orders imply an instance variable and a setter to allow
services to be injected into
- DomainObjectContainer container is provided automatically as a field
For entity properties:
entity Customer {
@ ... // annotations here
property String firstName {
set;
modify { ... }
clear { }
default { ... }
choices { ... }
hide { ... }
disable { ... }
validate { ... }
}
}
where
- property is a keyword
- String firstName
- implies the instance variable and the getter
- annotations can be specified, apply to the getter
- set;
- is optional,
- if present implies the setter (and so is a non-derived property)
- syntax borrowed from C#
- modify { ... }
- is optional
- if present, implies the modifyXxx(String value) method
- 'value' would be an implicitly available locally scoped parameter
- clear { ... }
- is optional
- if present, implies the void clearXxx() method
- default { ... }
- is optional
- if present, implies the String defaultXxx() method
- choices { ... }
- is optional
- if present, implies the List<String> choicesXxx() method
- hide { ... }
- is optional
- if present, implies the boolean clearXxx() method
- disable { ... }
- is optional
- if present, implies the String disableXxx() method
- validate { ... }
- is optional
- if present, implies the String validateXxx(String value) method
- 'value' would be an implicitly available locally scoped parameter
similarly for entity collections:
entity Customer {
@ ... // annotations here
collection List<Order> orders {
addTo { ... }
removeFrom { }
hide { ... }
disable { ... }
validateAddTo { ... }
validateRemoveFrom { ... }
}
}
where
- collection is a keyword
- otherwise similarly as properties
and similarly for entity actions:
entity Customer {
@... // annotations here
action Order placeOrder(
Product product {
default { }
choices { }
validate { }
},
int quantity {
default { }
choices { }
validate { }
}
) {
body { ... }
hide { ... }
disable { ... }
validate { ... }
}
}
where
- the name of the parameter would imply @Named(...)
- the default, choices, validate for the parameters apply to that parameter
- imply corresponding defaultNXxx(), choicesNXxx, validateNXxx()
- where N = parameter number
- body { ... }
- is the action body, with the parameters defined
- hide, disable
- similarly
- validate (at action level)
- corresponds to validateXxx(...)
- to validate the set of arguments rather than an individual parameter
Any members that do not follow the above rules are just copied over "as-is"
into Java.
~~~~~~~~~~~~
For values:
value FractionalNumber {
int numerator;
int denominator;
}
is basically the same as Lombok @Data
requires information in @ValueSemanticsProvider to be specified (somehow,
not sure exactly how)
~~~~~~~~~~~~
For services/repositories:
service ProductRepository {
}
where:
- any services are injected into as for entities
- DomainObjectContainer container is provided for free, again as for
entities
- actions as for entities
- properties and collections are disallowed
Re: A DSL for Apache Isis programming?
Posted by Minto van der Sluis <mi...@xup.nl>.
Hi Dan,
Can you give an example of what you think this DSL should look like?
Regards,
Minto
Op 3-10-2012 14:15, Dan Haywood schreef:
> Had a quick skim... I think XText looks more flexible. XCore seems to be a
> pre-baked language, whereas XText we could invent our own to some extent.
>
> They do look like close cousins, though.
>
> Dan
>
> On 3 October 2012 10:41, <mi...@xup.nl> wrote:
>
>> Hi Dan,
>>
>> I am a bit into DSL's and have played around with XText.
>>
>> Another interesting option might be XCore - http://wiki.eclipse.org/Xcore
>>
>> Regards,
>>
>> Minto
>>
>>
>>
>> Quoting Dan Haywood <da...@haywood-associates.co.uk>**:
>>
>> Dunno if anyone here is into DSLs, but it seems to me that the Apache Isis
>>> programming conventions [1] could be encapsulated quite nicely using a
>>> DSL.
>>> And if were going to do this (which I'm not, or at least, not yet), then
>>> I
>>> think I'd start by checking out Eclipse XText [2].
>>>
>>> Does this interest anyone? For a bit of fun, if nothing else.
>>>
>>> Cheers
>>> Dan
>>>
>>> [1] http://incubator.apache.org/**isis/IsisCheatSheet.pdf<http://incubator.apache.org/isis/IsisCheatSheet.pdf>
>>> [2] http://www.eclipse.org/Xtext/
>>>
>>>
>>
>
Re: A DSL for Apache Isis programming?
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Had a quick skim... I think XText looks more flexible. XCore seems to be a
pre-baked language, whereas XText we could invent our own to some extent.
They do look like close cousins, though.
Dan
On 3 October 2012 10:41, <mi...@xup.nl> wrote:
> Hi Dan,
>
> I am a bit into DSL's and have played around with XText.
>
> Another interesting option might be XCore - http://wiki.eclipse.org/Xcore
>
> Regards,
>
> Minto
>
>
>
> Quoting Dan Haywood <da...@haywood-associates.co.uk>**:
>
> Dunno if anyone here is into DSLs, but it seems to me that the Apache Isis
>> programming conventions [1] could be encapsulated quite nicely using a
>> DSL.
>> And if were going to do this (which I'm not, or at least, not yet), then
>> I
>> think I'd start by checking out Eclipse XText [2].
>>
>> Does this interest anyone? For a bit of fun, if nothing else.
>>
>> Cheers
>> Dan
>>
>> [1] http://incubator.apache.org/**isis/IsisCheatSheet.pdf<http://incubator.apache.org/isis/IsisCheatSheet.pdf>
>> [2] http://www.eclipse.org/Xtext/
>>
>>
>
Re: A DSL for Apache Isis programming?
Posted by mi...@xup.nl.
Hi Dan,
I am a bit into DSL's and have played around with XText.
Another interesting option might be XCore - http://wiki.eclipse.org/Xcore
Regards,
Minto
Quoting Dan Haywood <da...@haywood-associates.co.uk>:
> Dunno if anyone here is into DSLs, but it seems to me that the Apache Isis
> programming conventions [1] could be encapsulated quite nicely using a DSL.
> And if were going to do this (which I'm not, or at least, not yet), then I
> think I'd start by checking out Eclipse XText [2].
>
> Does this interest anyone? For a bit of fun, if nothing else.
>
> Cheers
> Dan
>
> [1] http://incubator.apache.org/isis/IsisCheatSheet.pdf
> [2] http://www.eclipse.org/Xtext/
>