Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328752

Summary: Xtext 1.0.1 tutorial: please simplify the example and add more features in later chapters
Product: [Modeling] TMF Reporter: Bernhard Merkle <bernhard.merkle>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: jan, sven.efftinge
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Bernhard Merkle CLA 2010-10-26 14:01:52 EDT
Build Identifier: 

Hi, some thoughts on the example of the Xtext 1.0.1

I would start a bit simpler than the current example, e.g.
- remove the entity interitance feature in the metamodel
- remove the * support for multiplicity support in the metamodel.

the reason is that new persons really get a bit confused when too much features are presented in the first place. Esp. the * once as syntax and once as Xtext mutiplicity confuesed students a bit. Additionally the inheritance really needs a constraint to be really usefull (or entity A could inherit from entity A).

so I propose:
1. start with a simpler meta model
2. add the multiplicity in a later step
3. add the entity inheritance in a later step
4. add a constraint for the entity inheritance

I would start with the following meta model:
if you point me to the doc sources i can  also fix this.



grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"

DomainModel:
 (elements+=Type)*;
 
Type:
Datatype | Entity;

Entity:
'entity' name=ID '{'
   (features+=Feature)*
'}';

Datatype:
'datatype' name=ID;

Feature:
 name=ID ':' type=[Type];



Reproducible: Always
Comment 1 Bernhard Merkle CLA 2010-10-26 14:06:28 EDT
as further comment: for students i usually start with a plain EMF example.
Initially this was in the oAW or Xtext tutorial but at some time was removed.
Why ? IMO teaching them the plain EMF example first has the following advantages:
- they know about emf and ecore at all :-)
- they have to build the meta model by hand and feel the pain
- they also have to add the genmodel and build by hand and feel the pain
- they have to build the data model and build instance via tree, again pain

after that I proceed with Xtext and they really appreciate all the support and magic of Xtext, also the textual vs. "tree and fiddling" approach.

so how about adding the EMF stuff as an (optional) preceeding chapter to the chapter 2 ?
Comment 2 Sven Efftinge CLA 2010-10-26 14:14:28 EDT
The sources are in the project org.eclipse.xtext.doc. The repository containing the project is hosted on git.eclipse.org. We are currently migrating from one documentation language to another, so it's not the best moment to improve the content. :-)
I'll tell you when the migration is finished.

Btw. it's the grammar not the meta model. And if you want to refer to the meta model in the tutorial, please call it the "ecore model", because that's the EMF terminology we use.

(In reply to comment #1)
> as further comment: for students i usually start with a plain EMF example.
> Initially this was in the oAW or Xtext tutorial but at some time was removed.
> Why ? IMO teaching them the plain EMF example first has the following
> advantages:
> - they know about emf and ecore at all :-)

They don't have to. It's a tutorial.

> - they have to build the meta model by hand and feel the pain
> - they also have to add the genmodel and build by hand and feel the pain
> - they have to build the data model and build instance via tree, again pain

You really think a tutorial should be painful?

> so how about adding the EMF stuff as an (optional) preceeding chapter to the
> chapter 2 ?

No, thanks. :-) We have some information about EMF later and think it's good to have it there.
The tutorial is really meant to get people started in short time. We want to leave out everything which is not absolutely necessary.
Comment 3 Bernhard Merkle CLA 2010-10-26 14:37:07 EDT
okay the more important stuff really was the proposal
1. start with a simpler grammar
2. add the multiplicity in a later step
3. add the entity inheritance in a later step
4. add a constraint for the entity inheritance
I hope you agree with that, so after migration this could be changed ? ;-)



> Btw. it's the grammar not the meta model. And if you want to refer to the meta
hm, in Xtext we mix abstract and concrete syntax within one file. the xtext file. so it is grammar + meta model IMO :-) (but we are getting ... now :-)

> model in the tutorial, please call it the "ecore model", because that's the EMF
> terminology we use.
ok 

> You really think a tutorial should be painful?
no, thats not the target at all
but i improves a bit the understanding of EMF and what Xtext is doing automagically for you and behind the scenes...
that is the reason why i first make a plain EMF exercises. 
but of course i can keep this private and for my own purposes.
Comment 4 Jan Koehnlein CLA 2011-11-11 09:34:28 EST
The tutorial has been completely reworked. Please reopen if it does not fit your needs.
Comment 5 Karsten Thoms CLA 2017-09-19 17:50:16 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 6 Karsten Thoms CLA 2017-09-19 18:01:09 EDT
Closing all bugs that were set to RESOLVED before Neon.0