You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Mohan Radhakrishnan <ra...@gmail.com> on 2018/01/10 14:35:13 UTC
DSL Recommendation
Hi,
I didn't know Groovy DSL's could be almost like plain english as shown
in
http://docs.groovy-lang.org/docs/latest/html/documentation/core-domain-
specific-languages.html
Is that the latest recommendation ? My use case is this.
I would like to create a small library to create XPath axes(
https://www.w3schools.com/xml/xpath_axes.asp) using a DSL.
Something like this.
id of ancestor of descendant of Node
This is just to create a more flexible way of using XPath expressions. I
don't plan to completely implement all expressions. Just a few.
Thanks,
Mohan
Re: DSL Recommendation
Posted by Mohan Radhakrishnan <ra...@gmail.com>.
The DSL will be used by other developers. It may seem counter-intuitive but
the team members are using Selenium and they code in a hurry. Selenium is
used here
to develop a Robotic Process Automation application. It is not used for
testing.
There is a need to abstract away some complicated XPath to help them. The
sad part is that the power of Groovy or even JDK 8 isn't used properly in
this particular RPA tool.
It is rather primitive in this case.
Thanks,
Mohan
On 10 January 2018 at 22:12, Jochen Theodorou <bl...@gmx.org> wrote:
>
>
> Am 10.01.2018 um 15:35 schrieb Mohan Radhakrishnan:
>
>> Hi,
>> I didn't know Groovy DSL's could be almost like plain english as
>> shown in
>> http://docs.groovy-lang.org/docs/latest/html/documentation/
>> core-domain-specific-languages.html <http://docs.groovy-lang.org/d
>> ocs/latest/html/documentation/core-domain-specific-languages.html>
>>
>> Is that the latest recommendation ? My use case is this.
>>
>> I would like to create a small library to create XPath axes(
>> https://www.w3schools.com/xml/xpath_axes.asp <
>> https://www.w3schools.com/xml/xpath_axes.asp>) using a DSL.
>>
>> Something like this.
>>
> >
>
>> id of ancestor of descendant of Node
>>
>> This is just to create a more flexible way of using XPath expressions. I
>> don't plan to completely implement all expressions. Just a few.
>>
>
>
> DSLs are always depending on who is going to use them. If they know Xpath
> a bit, then GPath: http://groovy-lang.org/processing-xml.html#_gpath
> would be my recommendation. Your suggestion for example is different than
> the often used top-down approach and is instead bottom-up. This can lead to
> a problem if your target audience is not used to that. On the other hand
> this can be exactly right... It really depends. Who is going to use it.
>
> bye Jochen
>
Re: DSL Recommendation
Posted by Jochen Theodorou <bl...@gmx.org>.
Am 10.01.2018 um 15:35 schrieb Mohan Radhakrishnan:
> Hi,
> I didn't know Groovy DSL's could be almost like plain english as
> shown in
> http://docs.groovy-lang.org/docs/latest/html/documentation/core-domain-specific-languages.html
> <http://docs.groovy-lang.org/docs/latest/html/documentation/core-domain-specific-languages.html>
>
> Is that the latest recommendation ? My use case is this.
>
> I would like to create a small library to create XPath
> axes(https://www.w3schools.com/xml/xpath_axes.asp
> <https://www.w3schools.com/xml/xpath_axes.asp>) using a DSL.
>
> Something like this.
>
> id of ancestor of descendant of Node
>
> This is just to create a more flexible way of using XPath expressions. I
> don't plan to completely implement all expressions. Just a few.
DSLs are always depending on who is going to use them. If they know
Xpath a bit, then GPath:
http://groovy-lang.org/processing-xml.html#_gpath would be my
recommendation. Your suggestion for example is different than the often
used top-down approach and is instead bottom-up. This can lead to a
problem if your target audience is not used to that. On the other hand
this can be exactly right... It really depends. Who is going to use it.
bye Jochen