Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Real business benefits of Xtext(Is Xtext an academic ivory tower)
Real business benefits of Xtext [message #1732975] Mon, 23 May 2016 13:59 Go to next message
Tony Chou is currently offline Tony ChouFriend
Messages: 8
Registered: January 2015
Junior Member
Please don't be offended by the topic/subject. I am just trying to figure this out.

The Xtext framework comes in with loaded features and I'm still overwhelmed by the learning curve required to pick up the vast amount of information and knowledge needed to drive this thing. I have done some studies on Rational Software Architect and did some OCL and was not able to understand ECore at that time. Then I started looking into DSL and then ended up at Xtext. I am amazed that for an Xtext project it generates so much code and projects for me. Now I decided to seek help in this forum.

So, after going through all the nice Xtext rules definition process, what am I supposed to do with my DSL?

Going thru Xtext process, a rule is a rule and it is fun to figure out the grammar. But afterwards, it still defines a language that someone need to be able to develop. Is its purpose so that a business person who is more familiar with the domain can quickly define the necessary "objects" used in that domain and be able to coordinate them more conveniently? In some way, this extra layer almost seems a waste of time. Why can't I simply define the underlying class using Java directly and use reflection to produce the UI?

I am not able to figure out the "saves" if all we want is so that it can use ECore to do provide more dynamic modeling capabilities. Doesn't Java's reflection API good enough for this? I am sorry but I just can't understand the connections and advantages of using Xtext and really can use some help in guiding me.

Nowadays you have all kind of frameworks that are supposed to help you with your work. For example, you could have your aspect annotation do logging or database transaction management, and the Spring frameworks API.

Could someone please shed some light?

Sincerely,

Xtext 101 Student




Re: Real business benefits of Xtext [message #1732992 is a reply to message #1732975] Mon, 23 May 2016 15:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Tony,

I'm sure others will chime in but here's my two cents worth.


On 23.05.2016 15:59, Tony Chou wrote:
> Please don't be offended by the topic/subject. I am just trying to
> figure this out.
>
> The Xtext framework comes in with loaded features and I'm still
> overwhelmed by the learning curve required to pick up the vast amount
> of information and knowledge needed to drive this thing.
Of course doing all the same thing by hand yourself would take you years.
> I have done some studies on Rational Software Architect and did some
> OCL and was not able to understand ECore at that time.
What can I see. Ecore is really quite a simple thing. And there's more
than enough documentation, even a book.
> Then I started looking into DSL and then ended up at Xtext.
Why are you looking at DSLs? What is the purpose of a DSL for you?
> I am amazed that for an Xtext project it generates so much code and
> projects for me. Now I decided to seek help in this forum.
It certainly wouldn't be much fun or very productive to do that by hand.
>
> So, after going through all the nice Xtext rules definition process,
> what am I supposed to do with my DSL?
That would be up to you to answer. Certainly one fundamental point
would be that the target users should find it convenient to use, i.e.,
more convenient than a graphical editor or a forms-based editor.
>
> Going thru Xtext process, a rule is a rule and it is fun to figure out
> the grammar. But afterwards, it still defines a language that someone
> need to be able to develop.
Indeed.
> Is its purpose so that a business person who is more familiar with the
> domain can quickly define the necessary "objects" used in that domain
> and be able to coordinate them more conveniently?
Yes, of course.
> In some way, this extra layer almost seems a waste of time. Why can't
> I simply define the underlying class using Java directly and use
> reflection to produce the UI?
You could, and if that would make users happier, you should. And if you
like writing code by hand, then everyone is happy.
>
> I am not able to figure out the "saves" if all we want is so that it
> can use ECore to do provide more dynamic modeling capabilities.
> Doesn't Java's reflection API good enough for this?
No, not really. Can you use Java reflection to read and write an XML
serialization of your data? Maybe with enough funky annotations from
some other framework you could. But of course you'd be defining a model
that way too, just in another formalism...
> I am sorry but I just can't understand the connections and advantages
> of using Xtext and really can use some help in guiding me.
It's all a question of what is your domain and who are the end users in
that domain. You've said nothing about that...

> Nowadays you have all kind of frameworks that are supposed to help you
> with your work. For example, you could have your aspect annotation do
> logging or database transaction management, and the Spring frameworks
> API.
>
> Could someone please shed some light?
Xtext is all about defining a clear, concise notation for capturing what
the domain expert needs to express. That information is then generally
used as input to some other processing steps, where the steps depend
completely on the domain involved.
>
> Sincerely,
>
> Xtext 101 Student
>
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Real business benefits of Xtext [message #1732998 is a reply to message #1732975] Mon, 23 May 2016 16:01 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I presume you want a DSL because you have a domain-specific application,
so in modeling terms you want a DS model that controls/configures that
application. Xtext gives you limited help on the application side of the
model (possibly the generator helps but I've never used it.)

Where Xtext is really powerful is in supporting the
creation/maintainance of your DS model. From an annotated EBNF grammar
(Xtext) you get a DS model, parser, unparser, editor almost for free.
With a little effort you can enhance the ergonomics.

When I had this requirement a month ago I was pleasantly surprised that
I successfully created grammar and editor in less than a couple of
hours. AND I didn't encounter a single tooling bug.

(I have to agree that the generated code size is rather large. For an
editor, the size may be acceptable. If you only want a parser and are
really concerned about code size, I would still recommend Xtext, but
since it is model-based, an Xtext-to-something else may be attractive. I
have an xtext2lpg converter that enables me to diagnose non-LALR-ness of
the grammar - a little more work and it should be a viable parser using
Xtext as specification, but with a 90% code size and perhaps 50% speed
saving.)

Regards

Ed Willink

On 23/05/2016 14:59, Tony Chou wrote:
> Please don't be offended by the topic/subject. I am just trying to
> figure this out.
>
> The Xtext framework comes in with loaded features and I'm still
> overwhelmed by the learning curve required to pick up the vast amount
> of information and knowledge needed to drive this thing. I have done
> some studies on Rational Software Architect and did some OCL and was
> not able to understand ECore at that time. Then I started looking into
> DSL and then ended up at Xtext. I am amazed that for an Xtext project
> it generates so much code and projects for me. Now I decided to seek
> help in this forum.
>
> So, after going through all the nice Xtext rules definition process,
> what am I supposed to do with my DSL?
>
> Going thru Xtext process, a rule is a rule and it is fun to figure out
> the grammar. But afterwards, it still defines a language that someone
> need to be able to develop. Is its purpose so that a business person
> who is more familiar with the domain can quickly define the necessary
> "objects" used in that domain and be able to coordinate them more
> conveniently? In some way, this extra layer almost seems a waste of
> time. Why can't I simply define the underlying class using Java
> directly and use reflection to produce the UI?
>
> I am not able to figure out the "saves" if all we want is so that it
> can use ECore to do provide more dynamic modeling capabilities.
> Doesn't Java's reflection API good enough for this? I am sorry but I
> just can't understand the connections and advantages of using Xtext
> and really can use some help in guiding me.
> Nowadays you have all kind of frameworks that are supposed to help you
> with your work. For example, you could have your aspect annotation do
> logging or database transaction management, and the Spring frameworks
> API.
>
> Could someone please shed some light?
>
> Sincerely,
>
> Xtext 101 Student
>
>
>
>
>
Re: Real business benefits of Xtext [message #1733153 is a reply to message #1732998] Tue, 24 May 2016 12:59 Go to previous messageGo to next message
Tony Chou is currently offline Tony ChouFriend
Messages: 8
Registered: January 2015
Junior Member
Thanks so much for the two heavyweight responses and guidance!

So, now I have created two xtext projects, A and B, and worked out a very simple example of B dependent on A.

I then ran as "Eclipse Application" from B and ended up with a really simple General project with one DSL file.

In the DSL file I have two very simple statements. The editor looks great with syntax checker as you said.

Could you point me to how can I debug my DSL from the Workbench?

Sincerely,
Xtext 101 student



Re: Real business benefits of Xtext [message #1733156 is a reply to message #1733153] Tue, 24 May 2016 13:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi which Aspect of your dsl do you Want to debug?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Real business benefits of Xtext [message #1733159 is a reply to message #1733156] Tue, 24 May 2016 13:37 Go to previous messageGo to next message
Tony Chou is currently offline Tony ChouFriend
Messages: 8
Registered: January 2015
Junior Member
Hi Chris - Vielen Dank

I am still trying to orient my head in these forest of generated code.

I would like to debug the generated code from my DSL module. And I noticed the generated Xtend file has an override doGenerate code but all body is commented out. I am wondering whether I should place a break point there (and how...)

Thought I was able to put a breakpoint in that Xtend code so when I save changes to the DSL module that code would hit the breakpoint - even though the change is done in the Workbench I am with high hope it would hit that doGenerate. Am I on the right track or off by 100 miles?

Ich bin immer dort ....

Sincerely,
Xtext 102 student
Re: Real business benefits of Xtext [message #1733168 is a reply to message #1733159] Wed, 25 May 2016 04:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

Am not sure if i can follow you.

The generator is triggered when you save your Model file and autobuilder is running (i asume you started a new eclipse runtime App from the debug Menu and created a new project there Where you created the dsl file you Test)
Setting and working with breakpoints "basically" like in Java

So can you give some hints what you Are qctually doing step by step


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Real business benefits of Xtext [message #1733183 is a reply to message #1732975] Wed, 25 May 2016 07:57 Go to previous messageGo to next message
Axel Guckelsberger is currently offline Axel GuckelsbergerFriend
Messages: 354
Registered: July 2009
Senior Member
Hi Tony,

like others said before: first you need to be sure about the goals of
your DSL. What benefits are (or should be) involved in created models
for it? Only better understandability of problems or use cases of your
domain? Or also an improved productivity by further processing of these
models (e.g. by transforming them to other models or generating code
and/or further artifacts from them)? How should model creation look like
/ should be done: there are different types of notations possible, like
textual, graphical, structural (table, trees, forms) and hybrid
combinations.

After you answered these basic questions you can look for a set of
tooling supporting your demands. EMF/Ecore as well as Xtext will
probably be included in this set, but the Eclipse modeling ecosystem
offers much more, too.

To notice the benefits of meta modeling (building your meta models with
terms of Ecore) against a code-based definition, you might read some
theoretic basics about model-driven software development (mdsd) in
general. Briefly this is primarily about abstraction, precise notations
and terminology understandable also for your domain experts (who do not
necessarily have technical experience). Also a meta model helps to
ensure the integrity of your DSL, as it contains some important
constraints. The meta model defines how a model may look like and how
it's elements may work together.

To sum it up: if you are clear about your requirements, your goals and
your vision, you can probably better incorporate the features of Xtext
and other modeling frameworks of Eclipse into your plan/roadmap.

HTH
Axel


Am 23.05.2016 um 15:59 schrieb Tony Chou:
> Please don't be offended by the topic/subject. I am just trying to
> figure this out.
>
> The Xtext framework comes in with loaded features and I'm still
> overwhelmed by the learning curve required to pick up the vast amount
> of information and knowledge needed to drive this thing. I have done
> some studies on Rational Software Architect and did some OCL and was not
> able to understand ECore at that time. Then I started looking into DSL
> and then ended up at Xtext. I am amazed that for an Xtext project it
> generates so much code and projects for me. Now I decided to seek help
> in this forum.
>
> So, after going through all the nice Xtext rules definition process,
> what am I supposed to do with my DSL?
>
> Going thru Xtext process, a rule is a rule and it is fun to figure out
> the grammar. But afterwards, it still defines a language that someone
> need to be able to develop. Is its purpose so that a business person who
> is more familiar with the domain can quickly define the necessary
> "objects" used in that domain and be able to coordinate them more
> conveniently? In some way, this extra layer almost seems a waste of
> time. Why can't I simply define the underlying class using Java directly
> and use reflection to produce the UI?
>
> I am not able to figure out the "saves" if all we want is so that it can
> use ECore to do provide more dynamic modeling capabilities. Doesn't
> Java's reflection API good enough for this? I am sorry but I just can't
> understand the connections and advantages of using Xtext and really can
> use some help in guiding me.
> Nowadays you have all kind of frameworks that are supposed to help you
> with your work. For example, you could have your aspect annotation do
> logging or database transaction management, and the Spring frameworks API.
>
> Could someone please shed some light?
>
> Sincerely,
>
> Xtext 101 Student
>
>
>
>
>
Re: Real business benefits of Xtext [message #1733211 is a reply to message #1733183] Wed, 25 May 2016 12:45 Go to previous messageGo to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
Hi Tony,

whenever I find after implementing 3 components and having 50 more on the list,
that I have 95% typed the same codelines; it's time to prepare for mass production:

1) Compare the code(s) you have written: you will see a lot of boilerplate code and "variables"
- replace these variables with ${placeholders}
- in your eclipse editor, load these "building blocks" as templates
- from now on, call the building blocks and all you have to type are the variables => big improvement

2) if you want to do a bit more support, you just need the basis of xtext/xtend:
(ALWAYS start with the output:)
- Create a Xtext Generator which uses these building blocks
- now you need a way to enter the variables: put it in your grammar
- generate your editor / generator AND USE IT

... it's very flexible, can handle even nested logic etc. and all for your private use.
once you have started it, you may find 100 reasons to improve it (which still SAVES you time).
Re: Real business benefits of Xtext [message #1733212 is a reply to message #1733168] Wed, 25 May 2016 12:54 Go to previous messageGo to next message
Tony Chou is currently offline Tony ChouFriend
Messages: 8
Registered: January 2015
Junior Member
Yes. That was what I did. I am able to Debug As then chose Eclipse to start the WorkBench. Then I made a change in my DSL and was able to step through the code in the Xtend doGenerate code. I am able to do a rudimentary end-to-end DSL now.

So, the question still comes to mind about my application. I believe the value added is the doGenerate function provides a layer of mapping/abstraction so that I can customize to however I need to using the framework. For example, provide some integration work so the screen rendering and whatnot can be achieved. Very nice!

Is the generated code going to be executed on ECore still? Doesn't that slow down performance?

Thanks again!

Re: Real business benefits of Xtext [message #1733215 is a reply to message #1733212] Wed, 25 May 2016 06:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
you get the emf resource passed and work on the AST / instance of the metamodel if this is what you ask

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Real business benefits of Xtext [message #1733216 is a reply to message #1733212] Wed, 25 May 2016 13:18 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
p.s: the performance point i dont get. if you do a lot generating code will slow down the build performance for sure

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Real business benefits of Xtext [message #1733218 is a reply to message #1733216] Wed, 25 May 2016 13:16 Go to previous messageGo to next message
Tony Chou is currently offline Tony ChouFriend
Messages: 8
Registered: January 2015
Junior Member
Hi Chris -

The performance I meant was runtime.

When I stepped through the Unit Test code, I noticed it was calling ECore code, which makes sense to me since DSL is built on top of ECore.

So, if everything runs in ECore, doesn't that slow things down?

Sincerely,
XText 102 Student
Re: Real business benefits of Xtext [message #1733220 is a reply to message #1733218] Wed, 25 May 2016 13:25 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Tony,

If you're concerned about performance measure it.

EMF is industrial strength, and so while you might not guess from
looking at implementation code, if you actually measure, you'll find
that eObject.eGet(eStructureFeature) is faster than hashMap.get(key).
I.e., it's faster to look up reflectively (using EMF reflection) the
value of a feature from an EObject than it is to lookup a value in a
HashMap by hashed key. And you've no doubt never asked the question,
will using a HashMap slow my code down?


On 25.05.2016 15:16, Tony Chou wrote:
> Hi Chris -
> The performance I meant was runtime.
>
> When I stepped through the Unit Test code, I noticed it was calling
> ECore code, which makes sense to me since DSL is built on top of ECore.
>
> So, if everything runs in ECore, doesn't that slow things down?
>
> Sincerely,
> XText 102 Student
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to solve multiple inheritance within a DSL
Next Topic:Antlr Error with grammar
Goto Forum:
  


Current Time: Sat Apr 20 00:29:49 GMT 2024

Powered by FUDForum. Page generated in 0.03373 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top