SlideShare une entreprise Scribd logo
1  sur  23
EMF Dos and Don ts
Maximilian Koegel
mkoegel@eclipsesource.com

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

1
EMF is very powerful but…
“The first 90% of the code accounts for the first 90% of
the development time. The remaining 10% of the code
accounts for the other 90% of the development time.”
Tom Cargill

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

2
Example Model and Application
• Application to manage bowling games and players
• Model with players and games

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

3
Example #1
Problem: Every game in a resource is changed to
professional on resource load iff it points to a
professional player
Cause: Custom code is triggered during resource load
and sets game to professional

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

4
Don t #1: Change generated getters/setters
Reason:
• Generated getters and setters are widely used by:
• EMF Core Framework, e.g. Resources, EcoreUtil.copy()
• EMF-based Frameworks, e.g. Teneo, CDO, EMFStore, EEF

• Changing it may have unexpected side effects
Mitigation:
Do not change the generated getters/setters but move
this code into controller classes (MVC pattern), e.g.
Commands
© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

5
Example #2
Problem: Players are lost in old game if assigned to
new game
Cause:
• Reference containment property changed
• Generated getter is not updated
• Players can only be contained in at most one game

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

6
Do #2: Use pattern for replacing gen. code

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

7
Example #3
Problem: Non-professional Players are reset to
professional players when copied
Cause:
• Changed factory method in EMF factory to init default
values
• Values will be set to init value on copy

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

8
Don t #3: Default initialization in EMF factory
Reason:
• Generated factories is widely used by:
• EMF Core Framework, e.g. Resources, EcoreUtil.copy()
• EMF-based Frameworks, e.g. Teneo, CDO, EMFStore

• Changing it may have unexpected side effects
Mitigations:
• Default values can be set in Ecore
• More complicated default initialization, e.g. creating
containment children, should go into controller code

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

9
Example #4
Problem: CDO-Server throws NPE at startup
Cause: Bug in CDO 4.0 with sub-packages

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

10
Don t #4: Use of sub-packages
Reasons:
• Do not use sub-packages
• Ed Merks (EMF): “Subpackages are evil!”
• Many bugs and problems in frameworks result from
subpackage support
Mitigation: Use multiple Ecores

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

11
Examples #5: Containment structure
Model:
• Car
• Motor is contained in Car?
• Tire is contained Car?

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

12
Dos #5: Design Containment Structure
• Design a containment structure following your
application domain:
• Which objects belongs to which other object?
• Should this object be copied/deleted if the other object is
copied/deleted?

• Avoid flat collections of EObjects:
• Might be slow if there are many objects
• Difficult to visualize

• Allow the end-users to structure their data from an
application domain point of view: e.g. Folder-like
Elements
© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

13
Example #6
Problems:
• Application slow-down over time
• Application uses exceeding amounts of memory
• “Widget is disposed” – Exceptions
Cause: Missing Adapter Disposals

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

14
Dos #6: Carefully use Adapters
Reasons:
• Adapters will use more and more memory
• If UI Widgets are disposed without adapters
Exceptions result
Mitigations:
• Make sure adapters are disposed properly
• Use content and cross reference adapter wisely
• Establish tests for proper adapter removal
• Adapter count before and after test is same
© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

15
Example #7
Problems:
• Undo sometimes does not work
• Implementing Undo is a lot of work
Cause: Manual Command Implementation

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

16
Dos #7: Use EMF Commands
Reasons:
• EMF Commands support undo/redo out of the box
• Allow integration with Transactional Command Stack
• Defines granularity of changes for other frameworks
Implementation:

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

17
Example #8
Problems:
• UI does not update to new values in the model
• “Widget is disposed” – Exceptions
Cause: Data binding buggy

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

18
Dos #8: Use Databinding
Reasons:
• Avoid update problems
• Databinding uses commands with undo/redo support
• Adapters are properly disposed off
Implementation:

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

19
Example #9
Problem: Deleting elements takes too much time
Cause: EcoreUtil.delete() is used for deletion

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

20
Dos #9: Carefully use EcoreUtil.delete()
Cause:
• Considers whole ResourceSet
• Slow if many Eobjects in ResourceSet
Mitigations:
• Make sure there are no or only known incoming
cross-references
• Use Cross-Reference Adapter to speed up cross
reference look-up

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

21
Don ts #10: Build on generated editor
Reasons:
• Editor meant as an example only
• No defined extensibility, code is generated
• No update strategy to new versions of EMF
Mitigations:
• Use EMF reflection to build custom editor
• Use EEF
• Use EMF Client Platform

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

22
More information on EMF
•
•
•
•

EMF Book
EMF Newsgroup
The EMF Source Code
EMF Dos and Don´ts Blog Series
• Google “EMF Dos and Don´ts”
• http://goo.gl/hGcCvJ

• Talk on EMF Client Platform at 2:30 pm today:
• “Are you still manually coding UIs?”

© 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts

23

Contenu connexe

En vedette

Īpašības vārds (zināšanu pārbaude 6.kl.)
Īpašības vārds (zināšanu pārbaude 6.kl.)Īpašības vārds (zināšanu pārbaude 6.kl.)
Īpašības vārds (zināšanu pārbaude 6.kl.)Aija Barovska
 
“Ūdens resursi. Saglabāsim ūdeni kopā!” Pasaules lielākā mācību stunda Daugav...
“Ūdens resursi. Saglabāsim ūdeni kopā!” Pasaules lielākā mācību stunda Daugav...“Ūdens resursi. Saglabāsim ūdeni kopā!” Pasaules lielākā mācību stunda Daugav...
“Ūdens resursi. Saglabāsim ūdeni kopā!” Pasaules lielākā mācību stunda Daugav...liela_stunda
 
Nokrisnu udens savaksana_10m
Nokrisnu udens savaksana_10mNokrisnu udens savaksana_10m
Nokrisnu udens savaksana_10mInese Pabērza
 
āBeces svētki
āBeces svētkiāBeces svētki
āBeces svētkitilzasbibl
 
Erudīcijas spēle 7.klasei
Erudīcijas spēle 7.klaseiErudīcijas spēle 7.klasei
Erudīcijas spēle 7.klaseiBruno Bahs
 
100 dienas skola
100 dienas skola100 dienas skola
100 dienas skolavizav
 
Veselīgs dzīves veids
Veselīgs dzīves veidsVeselīgs dzīves veids
Veselīgs dzīves veidsl7sakumskola
 
1.semestra pārbaudes darbs 4.klase Dbaszinības
1.semestra pārbaudes darbs 4.klase Dbaszinības1.semestra pārbaudes darbs 4.klase Dbaszinības
1.semestra pārbaudes darbs 4.klase Dbaszinībasl7sakumskola
 
Apģērba kultūra.
Apģērba kultūra. Apģērba kultūra.
Apģērba kultūra. l7sakumskola
 
Soc.zin - nauda 4.kl.
Soc.zin - nauda 4.kl.Soc.zin - nauda 4.kl.
Soc.zin - nauda 4.kl.l7sakumskola
 
1.semestra pārbaudes darbs 4.klase
1.semestra pārbaudes darbs 4.klase 1.semestra pārbaudes darbs 4.klase
1.semestra pārbaudes darbs 4.klase l7sakumskola
 
Elektronika dažās ierīcēs. Fizika medicīnā. Iespējamie enerģijas izmantošanas...
Elektronika dažās ierīcēs. Fizika medicīnā. Iespējamie enerģijas izmantošanas...Elektronika dažās ierīcēs. Fizika medicīnā. Iespējamie enerģijas izmantošanas...
Elektronika dažās ierīcēs. Fizika medicīnā. Iespējamie enerģijas izmantošanas...Daina Birkenbauma
 
1.semestra pārbaudes darbs 4.klase Matemātika
1.semestra pārbaudes darbs 4.klase Matemātika1.semestra pārbaudes darbs 4.klase Matemātika
1.semestra pārbaudes darbs 4.klase Matemātikal7sakumskola
 

En vedette (20)

Īpašības vārds (zināšanu pārbaude 6.kl.)
Īpašības vārds (zināšanu pārbaude 6.kl.)Īpašības vārds (zināšanu pārbaude 6.kl.)
Īpašības vārds (zināšanu pārbaude 6.kl.)
 
“Ūdens resursi. Saglabāsim ūdeni kopā!” Pasaules lielākā mācību stunda Daugav...
“Ūdens resursi. Saglabāsim ūdeni kopā!” Pasaules lielākā mācību stunda Daugav...“Ūdens resursi. Saglabāsim ūdeni kopā!” Pasaules lielākā mācību stunda Daugav...
“Ūdens resursi. Saglabāsim ūdeni kopā!” Pasaules lielākā mācību stunda Daugav...
 
Nokrisnu udens savaksana_10m
Nokrisnu udens savaksana_10mNokrisnu udens savaksana_10m
Nokrisnu udens savaksana_10m
 
āBeces svētki
āBeces svētkiāBeces svētki
āBeces svētki
 
Erudīcijas spēle 7.klasei
Erudīcijas spēle 7.klaseiErudīcijas spēle 7.klasei
Erudīcijas spēle 7.klasei
 
100 dienas skola
100 dienas skola100 dienas skola
100 dienas skola
 
Veselīgs dzīves veids
Veselīgs dzīves veidsVeselīgs dzīves veids
Veselīgs dzīves veids
 
Putni ziemā
Putni ziemāPutni ziemā
Putni ziemā
 
Skaitļa vārds
Skaitļa vārdsSkaitļa vārds
Skaitļa vārds
 
1.semestra pārbaudes darbs 4.klase Dbaszinības
1.semestra pārbaudes darbs 4.klase Dbaszinības1.semestra pārbaudes darbs 4.klase Dbaszinības
1.semestra pārbaudes darbs 4.klase Dbaszinības
 
Kas ir udens_31m
Kas ir udens_31mKas ir udens_31m
Kas ir udens_31m
 
Apģērba kultūra.
Apģērba kultūra. Apģērba kultūra.
Apģērba kultūra.
 
Dzīvnieku valsts
Dzīvnieku valstsDzīvnieku valsts
Dzīvnieku valsts
 
Soc.zin - nauda 4.kl.
Soc.zin - nauda 4.kl.Soc.zin - nauda 4.kl.
Soc.zin - nauda 4.kl.
 
Augi
AugiAugi
Augi
 
B 10 9_dzivnieki
B 10 9_dzivniekiB 10 9_dzivnieki
B 10 9_dzivnieki
 
1.semestra pārbaudes darbs 4.klase
1.semestra pārbaudes darbs 4.klase 1.semestra pārbaudes darbs 4.klase
1.semestra pārbaudes darbs 4.klase
 
Elektronika dažās ierīcēs. Fizika medicīnā. Iespējamie enerģijas izmantošanas...
Elektronika dažās ierīcēs. Fizika medicīnā. Iespējamie enerģijas izmantošanas...Elektronika dažās ierīcēs. Fizika medicīnā. Iespējamie enerģijas izmantošanas...
Elektronika dažās ierīcēs. Fizika medicīnā. Iespējamie enerģijas izmantošanas...
 
1.semestra pārbaudes darbs 4.klase Matemātika
1.semestra pārbaudes darbs 4.klase Matemātika1.semestra pārbaudes darbs 4.klase Matemātika
1.semestra pārbaudes darbs 4.klase Matemātika
 
Cilvēka uzbūve
Cilvēka uzbūveCilvēka uzbūve
Cilvēka uzbūve
 

Similaire à EMF Dos and Don’ts EclipseCon Europe 2013

EMFStore Model Repository @ Modeling Symposium ECE 2013
EMFStore Model Repository @ Modeling Symposium ECE 2013EMFStore Model Repository @ Modeling Symposium ECE 2013
EMFStore Model Repository @ Modeling Symposium ECE 2013Maximilian Kögel
 
Democamp Munich 2013: Are you still manually coding UIs?
Democamp Munich 2013: Are you still manually coding UIs?Democamp Munich 2013: Are you still manually coding UIs?
Democamp Munich 2013: Are you still manually coding UIs?Maximilian Kögel
 
Are you still manually coding UIs? - EclipseCon Europe 2013
Are you still manually coding UIs? - EclipseCon Europe 2013Are you still manually coding UIs? - EclipseCon Europe 2013
Are you still manually coding UIs? - EclipseCon Europe 2013Maximilian Kögel
 
Which cloud(s) & why? Defining Clouds and Best Practices
Which cloud(s) & why? Defining Clouds and Best PracticesWhich cloud(s) & why? Defining Clouds and Best Practices
Which cloud(s) & why? Defining Clouds and Best PracticesPaul Weiss
 
Model migration - there and back again (ECE2014)
Model migration - there and back again (ECE2014)Model migration - there and back again (ECE2014)
Model migration - there and back again (ECE2014)Maximilian Kögel
 
IBM Cloud Côte d'Azur Meetup - 20190328 - Optimisation
IBM Cloud Côte d'Azur Meetup - 20190328 - OptimisationIBM Cloud Côte d'Azur Meetup - 20190328 - Optimisation
IBM Cloud Côte d'Azur Meetup - 20190328 - OptimisationIBM France Lab
 
New Repository in AEM 6 by Michael Marth
New Repository in AEM 6 by Michael MarthNew Repository in AEM 6 by Michael Marth
New Repository in AEM 6 by Michael MarthAEM HUB
 
Diving Deeper into DevOps Deployments
Diving Deeper into DevOps DeploymentsDiving Deeper into DevOps Deployments
Diving Deeper into DevOps DeploymentsJules Pierre-Louis
 
Cost Effectiveness of Software Reuse Alternatives
Cost Effectiveness of Software Reuse AlternativesCost Effectiveness of Software Reuse Alternatives
Cost Effectiveness of Software Reuse AlternativesProf. Amir Tomer
 
Doing work in the background - Darryn Campbell, Zebra Technologies
Doing work in the background - Darryn Campbell, Zebra TechnologiesDoing work in the background - Darryn Campbell, Zebra Technologies
Doing work in the background - Darryn Campbell, Zebra TechnologiesDroidConTLV
 
10 Do’s for DevOps!
 10 Do’s for DevOps!  10 Do’s for DevOps!
10 Do’s for DevOps! DevOps.com
 
Basic Technology - Module 13 cloud computing
Basic Technology - Module 13 cloud computingBasic Technology - Module 13 cloud computing
Basic Technology - Module 13 cloud computingsolarisyougood
 
JavaOne 2014: Next Step in Automation: Elastic Build Environment
JavaOne 2014: Next Step in Automation: Elastic Build EnvironmentJavaOne 2014: Next Step in Automation: Elastic Build Environment
JavaOne 2014: Next Step in Automation: Elastic Build EnvironmentKohsuke Kawaguchi
 
EMF Client Platform @ Modeling Symposium EclipseCon North America 2012
EMF Client Platform @ Modeling Symposium EclipseCon North America 2012EMF Client Platform @ Modeling Symposium EclipseCon North America 2012
EMF Client Platform @ Modeling Symposium EclipseCon North America 2012JonasHelming
 
JavaOne 2016 "Java, Microservices, Cloud and Containers"
JavaOne 2016 "Java, Microservices, Cloud and Containers"JavaOne 2016 "Java, Microservices, Cloud and Containers"
JavaOne 2016 "Java, Microservices, Cloud and Containers"Daniel Bryant
 
15 EMF projects in 25 minutes
15 EMF projects in 25 minutes15 EMF projects in 25 minutes
15 EMF projects in 25 minutesCédric Brun
 
Tanay Nagjee - Electric Cloud - Better Continuous Integration with Test Accel...
Tanay Nagjee - Electric Cloud - Better Continuous Integration with Test Accel...Tanay Nagjee - Electric Cloud - Better Continuous Integration with Test Accel...
Tanay Nagjee - Electric Cloud - Better Continuous Integration with Test Accel...DevOps Enterprise Summit
 
Simulation Training Post Fukushima
Simulation Training Post FukushimaSimulation Training Post Fukushima
Simulation Training Post FukushimaGSE Systems, Inc.
 
Building business u is with emf forms
Building business u is with emf formsBuilding business u is with emf forms
Building business u is with emf formsMaximilian Kögel
 

Similaire à EMF Dos and Don’ts EclipseCon Europe 2013 (20)

EMFStore Model Repository @ Modeling Symposium ECE 2013
EMFStore Model Repository @ Modeling Symposium ECE 2013EMFStore Model Repository @ Modeling Symposium ECE 2013
EMFStore Model Repository @ Modeling Symposium ECE 2013
 
Democamp Munich 2013: Are you still manually coding UIs?
Democamp Munich 2013: Are you still manually coding UIs?Democamp Munich 2013: Are you still manually coding UIs?
Democamp Munich 2013: Are you still manually coding UIs?
 
Are you still manually coding UIs? - EclipseCon Europe 2013
Are you still manually coding UIs? - EclipseCon Europe 2013Are you still manually coding UIs? - EclipseCon Europe 2013
Are you still manually coding UIs? - EclipseCon Europe 2013
 
Which cloud(s) & why? Defining Clouds and Best Practices
Which cloud(s) & why? Defining Clouds and Best PracticesWhich cloud(s) & why? Defining Clouds and Best Practices
Which cloud(s) & why? Defining Clouds and Best Practices
 
Model migration - there and back again (ECE2014)
Model migration - there and back again (ECE2014)Model migration - there and back again (ECE2014)
Model migration - there and back again (ECE2014)
 
IBM Cloud Côte d'Azur Meetup - 20190328 - Optimisation
IBM Cloud Côte d'Azur Meetup - 20190328 - OptimisationIBM Cloud Côte d'Azur Meetup - 20190328 - Optimisation
IBM Cloud Côte d'Azur Meetup - 20190328 - Optimisation
 
New Repository in AEM 6 by Michael Marth
New Repository in AEM 6 by Michael MarthNew Repository in AEM 6 by Michael Marth
New Repository in AEM 6 by Michael Marth
 
Diving Deeper into DevOps Deployments
Diving Deeper into DevOps DeploymentsDiving Deeper into DevOps Deployments
Diving Deeper into DevOps Deployments
 
Cost Effectiveness of Software Reuse Alternatives
Cost Effectiveness of Software Reuse AlternativesCost Effectiveness of Software Reuse Alternatives
Cost Effectiveness of Software Reuse Alternatives
 
Doing work in the background - Darryn Campbell, Zebra Technologies
Doing work in the background - Darryn Campbell, Zebra TechnologiesDoing work in the background - Darryn Campbell, Zebra Technologies
Doing work in the background - Darryn Campbell, Zebra Technologies
 
10 Do’s for DevOps!
 10 Do’s for DevOps!  10 Do’s for DevOps!
10 Do’s for DevOps!
 
Basic Technology - Module 13 cloud computing
Basic Technology - Module 13 cloud computingBasic Technology - Module 13 cloud computing
Basic Technology - Module 13 cloud computing
 
JavaOne 2014: Next Step in Automation: Elastic Build Environment
JavaOne 2014: Next Step in Automation: Elastic Build EnvironmentJavaOne 2014: Next Step in Automation: Elastic Build Environment
JavaOne 2014: Next Step in Automation: Elastic Build Environment
 
EMF Client Platform @ Modeling Symposium EclipseCon North America 2012
EMF Client Platform @ Modeling Symposium EclipseCon North America 2012EMF Client Platform @ Modeling Symposium EclipseCon North America 2012
EMF Client Platform @ Modeling Symposium EclipseCon North America 2012
 
JavaOne 2016 "Java, Microservices, Cloud and Containers"
JavaOne 2016 "Java, Microservices, Cloud and Containers"JavaOne 2016 "Java, Microservices, Cloud and Containers"
JavaOne 2016 "Java, Microservices, Cloud and Containers"
 
15 EMF projects in 25 minutes
15 EMF projects in 25 minutes15 EMF projects in 25 minutes
15 EMF projects in 25 minutes
 
Tanay Nagjee - Electric Cloud - Better Continuous Integration with Test Accel...
Tanay Nagjee - Electric Cloud - Better Continuous Integration with Test Accel...Tanay Nagjee - Electric Cloud - Better Continuous Integration with Test Accel...
Tanay Nagjee - Electric Cloud - Better Continuous Integration with Test Accel...
 
Simulation Training Post Fukushima
Simulation Training Post FukushimaSimulation Training Post Fukushima
Simulation Training Post Fukushima
 
Jchem Paint
Jchem PaintJchem Paint
Jchem Paint
 
Building business u is with emf forms
Building business u is with emf formsBuilding business u is with emf forms
Building business u is with emf forms
 

Plus de Maximilian Kögel

Building Business UIs with EMF Forms (ECE2014)
Building Business UIs with EMF Forms (ECE2014)Building Business UIs with EMF Forms (ECE2014)
Building Business UIs with EMF Forms (ECE2014)Maximilian Kögel
 
EMFStore Demo EclipseCon2012
EMFStore Demo EclipseCon2012EMFStore Demo EclipseCon2012
EMFStore Demo EclipseCon2012Maximilian Kögel
 
What´s (new with) EMFStore?
What´s (new with) EMFStore?What´s (new with) EMFStore?
What´s (new with) EMFStore?Maximilian Kögel
 
Only one Click to an EMF Application
Only one Click to an EMF ApplicationOnly one Click to an EMF Application
Only one Click to an EMF ApplicationMaximilian Kögel
 
How to Distribute, Store and Version Models with EMFStore
How to Distribute, Store and Version Models with EMFStoreHow to Distribute, Store and Version Models with EMFStore
How to Distribute, Store and Version Models with EMFStoreMaximilian Kögel
 
EmfStore - A Repository for EMF Models
EmfStore - A Repository for EMF ModelsEmfStore - A Repository for EMF Models
EmfStore - A Repository for EMF ModelsMaximilian Kögel
 

Plus de Maximilian Kögel (7)

Building Business UIs with EMF Forms (ECE2014)
Building Business UIs with EMF Forms (ECE2014)Building Business UIs with EMF Forms (ECE2014)
Building Business UIs with EMF Forms (ECE2014)
 
EMFStore Demo EclipseCon2012
EMFStore Demo EclipseCon2012EMFStore Demo EclipseCon2012
EMFStore Demo EclipseCon2012
 
What´s (new with) EMFStore?
What´s (new with) EMFStore?What´s (new with) EMFStore?
What´s (new with) EMFStore?
 
Only one Click to an EMF Application
Only one Click to an EMF ApplicationOnly one Click to an EMF Application
Only one Click to an EMF Application
 
How to Distribute, Store and Version Models with EMFStore
How to Distribute, Store and Version Models with EMFStoreHow to Distribute, Store and Version Models with EMFStore
How to Distribute, Store and Version Models with EMFStore
 
EmfStoreTutorial
EmfStoreTutorialEmfStoreTutorial
EmfStoreTutorial
 
EmfStore - A Repository for EMF Models
EmfStore - A Repository for EMF ModelsEmfStore - A Repository for EMF Models
EmfStore - A Repository for EMF Models
 

Dernier

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Dernier (20)

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

EMF Dos and Don’ts EclipseCon Europe 2013

  • 1. EMF Dos and Don ts Maximilian Koegel mkoegel@eclipsesource.com © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 1
  • 2. EMF is very powerful but… “The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” Tom Cargill © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 2
  • 3. Example Model and Application • Application to manage bowling games and players • Model with players and games © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 3
  • 4. Example #1 Problem: Every game in a resource is changed to professional on resource load iff it points to a professional player Cause: Custom code is triggered during resource load and sets game to professional © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 4
  • 5. Don t #1: Change generated getters/setters Reason: • Generated getters and setters are widely used by: • EMF Core Framework, e.g. Resources, EcoreUtil.copy() • EMF-based Frameworks, e.g. Teneo, CDO, EMFStore, EEF • Changing it may have unexpected side effects Mitigation: Do not change the generated getters/setters but move this code into controller classes (MVC pattern), e.g. Commands © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 5
  • 6. Example #2 Problem: Players are lost in old game if assigned to new game Cause: • Reference containment property changed • Generated getter is not updated • Players can only be contained in at most one game © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 6
  • 7. Do #2: Use pattern for replacing gen. code © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 7
  • 8. Example #3 Problem: Non-professional Players are reset to professional players when copied Cause: • Changed factory method in EMF factory to init default values • Values will be set to init value on copy © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 8
  • 9. Don t #3: Default initialization in EMF factory Reason: • Generated factories is widely used by: • EMF Core Framework, e.g. Resources, EcoreUtil.copy() • EMF-based Frameworks, e.g. Teneo, CDO, EMFStore • Changing it may have unexpected side effects Mitigations: • Default values can be set in Ecore • More complicated default initialization, e.g. creating containment children, should go into controller code © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 9
  • 10. Example #4 Problem: CDO-Server throws NPE at startup Cause: Bug in CDO 4.0 with sub-packages © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 10
  • 11. Don t #4: Use of sub-packages Reasons: • Do not use sub-packages • Ed Merks (EMF): “Subpackages are evil!” • Many bugs and problems in frameworks result from subpackage support Mitigation: Use multiple Ecores © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 11
  • 12. Examples #5: Containment structure Model: • Car • Motor is contained in Car? • Tire is contained Car? © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 12
  • 13. Dos #5: Design Containment Structure • Design a containment structure following your application domain: • Which objects belongs to which other object? • Should this object be copied/deleted if the other object is copied/deleted? • Avoid flat collections of EObjects: • Might be slow if there are many objects • Difficult to visualize • Allow the end-users to structure their data from an application domain point of view: e.g. Folder-like Elements © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 13
  • 14. Example #6 Problems: • Application slow-down over time • Application uses exceeding amounts of memory • “Widget is disposed” – Exceptions Cause: Missing Adapter Disposals © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 14
  • 15. Dos #6: Carefully use Adapters Reasons: • Adapters will use more and more memory • If UI Widgets are disposed without adapters Exceptions result Mitigations: • Make sure adapters are disposed properly • Use content and cross reference adapter wisely • Establish tests for proper adapter removal • Adapter count before and after test is same © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 15
  • 16. Example #7 Problems: • Undo sometimes does not work • Implementing Undo is a lot of work Cause: Manual Command Implementation © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 16
  • 17. Dos #7: Use EMF Commands Reasons: • EMF Commands support undo/redo out of the box • Allow integration with Transactional Command Stack • Defines granularity of changes for other frameworks Implementation: © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 17
  • 18. Example #8 Problems: • UI does not update to new values in the model • “Widget is disposed” – Exceptions Cause: Data binding buggy © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 18
  • 19. Dos #8: Use Databinding Reasons: • Avoid update problems • Databinding uses commands with undo/redo support • Adapters are properly disposed off Implementation: © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 19
  • 20. Example #9 Problem: Deleting elements takes too much time Cause: EcoreUtil.delete() is used for deletion © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 20
  • 21. Dos #9: Carefully use EcoreUtil.delete() Cause: • Considers whole ResourceSet • Slow if many Eobjects in ResourceSet Mitigations: • Make sure there are no or only known incoming cross-references • Use Cross-Reference Adapter to speed up cross reference look-up © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 21
  • 22. Don ts #10: Build on generated editor Reasons: • Editor meant as an example only • No defined extensibility, code is generated • No update strategy to new versions of EMF Mitigations: • Use EMF reflection to build custom editor • Use EEF • Use EMF Client Platform © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 22
  • 23. More information on EMF • • • • EMF Book EMF Newsgroup The EMF Source Code EMF Dos and Don´ts Blog Series • Google “EMF Dos and Don´ts” • http://goo.gl/hGcCvJ • Talk on EMF Client Platform at 2:30 pm today: • “Are you still manually coding UIs?” © 2013 EclipseSource | http://eclipsesource.com/munich | Dr. Maximilian Kögel | mkoegel@eclipsesource.com | EMF Dos and Don´ts 23