SlideShare a Scribd company logo
Modellgetriebene App-Entwicklung
für iPhone und Android
Heiko Behrens, itemis
Regionalgruppe Hamburg der GI
Hamburg 24.09.2010
@HBehrens
http://mobile.itemis.de
Dienstag, 28. September 2010
Modellgetriebene App-Entwicklung
für iPhone und Android
Dienstag, 28. September 2010
Modellgetriebene App-Entwicklung
für iPhone und Android
Dienstag, 28. September 2010
/ soft·ware de·vel·op·ment / n.
the set of activities that results in
software products. ~ may include
research, new development,
modification, reuse, maintenance,
or any other activities that result in
software products.
Dienstag, 28. September 2010
Typical Situations
in
Software Development
Dienstag, 28. September 2010
Boring code
Dienstag, 28. September 2010
Accidental complexity
Dienstag, 28. September 2010
Wrong level of abstraction
Dienstag, 28. September 2010
Anatomy of Modern Software
schematic code (manually written)
Libraries
Frameworks
manually written
code
Dienstag, 28. September 2010
Dienstag, 28. September 2010
package templates;
import java.util.*;
import java.io.Serializable;
import javax.persistence.*;
@SuppressWarnings("serial")
@Entity
public class Customer implements Serializable {
	 private Long id;
	 private String name;
	 private Address address;
	 private Set<Order> orders = new HashSet<Order>();
	 // No-arg constructor
	 public Customer() {
	 }
	 @Id
	 public Long getId() {
	 	 return id;
	 }
	 public void setId(Long id) {
	 	 this.id = id;
	 }
	 public String getName() {
	 	 return name;
	 }
	 public void setName(String name) {
	 	 this.name = name;
	 }
	 public Address getAddress() {
	 	 return address;
	 }
	 public void setAddress(Address address) {
	 	 this.address = address;
	 }
	 @OneToMany
	 public Collection<Order> getOrders() {
	 	 return orders;
	 }
	 public void setOrders(Set<Order> orders) {
	 	 this.orders = orders;
	 }
}
Dienstag, 28. September 2010
package templates;
import java.io.Serializable;
import java.util.*;
import javax.persistence.*;
@SuppressWarnings("serial")
@Entity
public class Customer implements Serializable {
	 private Long id;
	 private String name;
	 private Address address;
	 private Set<Order> orders = new HashSet<Order>();
	 // No-arg constructor
	 public Customer() {
	 }
	 @Id
	 public Long getId() {
	 	 return id;
	 }
	 public void setId(Long id) {
	 	 this.id = id;
	 }
	 public String getName() {
	 	 return name;
	 }
	 public void setName(String name) {
	 	 this.name = name;
	 }
	 public Address getAddress() {
	 	 return address;
	 }
	 public void setAddress(Address address) {
	 	 this.address = address;
	 }
	 @OneToMany
	 public Collection<Order> getOrders() {
	 	 return orders;
	 }
	 public void setOrders(Set<Order> orders) {
	 	 this.orders = orders;
	 }
}
Dienstag, 28. September 2010
Common Approaches
to
Avoid Redundancy
Dienstag, 28. September 2010
Wizards
Dienstag, 28. September 2010
This wizard whips up a
complete and running
legacy application with
just a single click.
Dienstag, 28. September 2010
Designers
Dienstag, 28. September 2010
Model-Driven
Software Development
Dienstag, 28. September 2010
Raise the level
of abstraction
where possible
and generate
code wisely.
Dienstag, 28. September 2010
One cannot
abstract away
everything.
Manual code is
great for all the
special cases and
details.
Dienstag, 28. September 2010
Use the best of both worlds at the same time.
Dienstag, 28. September 2010
Dienstag, 28. September 2010
Suppose...
Dienstag, 28. September 2010
You’d want to core an apple...
Dienstag, 28. September 2010
... for your kids.
Dienstag, 28. September 2010
Right tool for the job
?
Dienstag, 28. September 2010
Your trusty swiss army knife!
Dienstag, 28. September 2010
Suppose...
Dienstag, 28. September 2010
You’d want to core a few more apples...
Dienstag, 28. September 2010
... for an apple cake.
Dienstag, 28. September 2010
Still the best tool for the job?
Dienstag, 28. September 2010
Better use this one
Dienstag, 28. September 2010
...and this one
Dienstag, 28. September 2010
... a DSL is ...
Dienstag, 28. September 2010
A specific tool
for a specific job
Dienstag, 28. September 2010
A specific tool
for a specific job
Dienstag, 28. September 2010
Use DSLs to describe the world
Dienstag, 28. September 2010
select name, salary
from employees
where salary > 2000
order by salary
^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}$
Dienstag, 28. September 2010
http://mobl-lang.org/
http://code.google.com/p/iphonical/
http://code.google.com/p/applause/
applause
iPhonical
mobl
Dienstag, 28. September 2010
entity Vortrag {
	 String titel
	 String untertitel
	 String sprecher
	 String beschreibung
}
contentprovider AllVortragItems
	 returns Vortrag[]
	 fetches XML
	 	 from "http://spreadsheets.google.com/feeds/list/.../public/values"
	 	 selects "feed.entry"
tableview VortragListe(Vortrag[] items) {
	 title= "Vorträge"
	 section {
	 	 cell Subtitle foreach items as i {
	 	 	 text= i.titel
	 	 	 details= i.untertitel
	 	 	 action= VortragDetailsView( i )
	 	 }
	 }
}
tabbarApplication itemisApp {
	 button {
	 	 title= "Vorträge"
	 	 icon= "66-microphone.png"
	 	 view= VortragListe( AllVortragItems() )
	 }
	 button {
	 	 title= "Referenten"
	 	 icon= "person.png"
	 	 view= SprecherListe( AllSprecherItems() )
	 }
}
Entities & Data Access
Views & Actions
Navigation
Dienstag, 28. September 2010
... for building DSLs?
Why not use a DSL...
Dienstag, 28. September 2010
http://www.eclipse.org/Xtext/
@xtext
Dienstag, 28. September 2010
Superclass
Subclass Class
ECore meta model
LL(*) Parser Editor
Model
G
r
a
m
m
a
r
Generator
Runtime
Dienstag, 28. September 2010
Grammar (similar to EBNF)
grammar org.xtext.example.Entity with org.eclipse.xtext.common.Terminals
generate entity "http://www.xtext.org/example/Entity"
Model:
(types+=Type)*;
Type:
TypeDef | Entity;
TypeDef:
"typedef" name=ID ("mapsto" mappedType=JAVAID)?;
JAVAID:
name=ID("." ID)*;
Entity:
"entity" name=ID ("extends" superEntity=[Entity])?
"{"
(attributes+=Attribute)*
"}";
Attribute:
type=[Type] (many?="*")? name=ID;
Dienstag, 28. September 2010
grammar org.xtext.example.Entity
with org.eclipse.xtext.common.Terminals
generate entity
"http://www.xtext.org/example/Entity"
Model:
(types+=Type)*;
Type:
TypeDef | Entity;
TypeDef:
"typedef" name=ID
("mapsto" mappedType=JAVAID)?;
JAVAID:
name=ID("." ID)*;
Entity:
"entity" name=ID
("extends" superEntity=[Entity])?
"{"
(attributes+=Attribute)*
"}";
Attribute:
type=[Type] (many?="*")? name=ID;
entity
Model
*
name: EString
Type
types
TypeDef Entity
name: EString
JAVAID
superEntity
mappedType
name: EString
many: EBoolean
Attribute
attributes
type
Meta model inference
Dienstag, 28. September 2010
Let’s build a DSL
for Mobile Apps
Dienstag, 28. September 2010
Dienstag, 28. September 2010
Anatomy of an iPhone app
Table view
View title
Tab bar
Tab bar button
Name
Image
Speaker
Title
Location
Session
Entity
Data Provider
Table cell
Dienstag, 28. September 2010
Mapping concepts
Table view
View title
Table cell
Tab bar
Tab bar button
Entity
Data Provider
tabbarApplication itemisApp {
	 button {
	 	 title= "Blog"
	 	 icon= "08-chat.png"
	 	 view= BlogList( Blogposts() )
	 }
	 button {
	 	 title= "Talks"
	 	 icon= "66-microphone.png"
	 	 view= VortragListe( AllVortragItems() )
	 }
	 button {
	 	 title= "Speakers"
	 	 icon= "person.png"
	 	 view= SprecherListe( AllSprecherItems() )
	 }
}
Dienstag, 28. September 2010
Mapping concepts
Table view
View title
Table cell
Tab bar
Tab bar button
Entity
Data Provider
entity BlogItem {
	 String title
	 String author
	 String link
	 String description
	 String pubDate
	 BlogItem subItem
}
entity Sprecher {
	 String name
	 String beschreibung
	 String email
	 String blog
	 String fotourl
	 String vortraege
}
entity Vortrag {
	 String titel
	 String untertitel
	 String sprecher
	 String beschreibung
	 String zeit
	 Vortrag fortsetzung
}
Dienstag, 28. September 2010
Mapping concepts
Table view
View title
Table cell
Tab bar
Tab bar button
Entity
Data Provider
contentprovider Blogposts
	 returns BlogItem[]
	 fetches XML
	 	 from "http://blogs.itemis.de/?showfeed=1"
	 	 selects "rss.channel.item"
	
contentprovider AllVortragItems
	 returns Vortrag[]
	 fetches XML
	 	 from "http://spreadsheets.google.com/feeds/
list/0Au3-oaNYhfPIdEpRQWxpZnJyX2JCNUdtT1Z4M1B4SkE/1/
public/values"
	 	 selects "feed.entry"
Dienstag, 28. September 2010
Mapping concepts
Table view
View title
Table cell
Tab bar
Tab bar button
Entity
Data Provider tableview BlogList(BlogItem[] items) {
	 title= "itemis blog"
	 section {
	 	 cell Subtitle foreach items as i {
	 	 	 text= i.author
	 	 	 details= i.title
	 	 	 image= ("http://blogs.itemis.de/wp-content/
themes/itemis-WP-Theme/photos/" urlconform(i.author)
".jpg")
	 	 	 action= BlogDetails(i)
	 	 }
	 }
}
Dienstag, 28. September 2010
Type safe
Produces any
kind of text
Can run standalone
(ANT / Maven)
Debugger
Profiler
Eclipse-based
Editor
Protected regions
Cartridges
Outlets
Polymorphism
Dienstag, 28. September 2010
tableview SpeakerList(
Speaker[] speakers)
{
title= "Speakers"
section
{
cell Default foreach
speakers as speaker
{
text= speaker.name
image= speaker.smallImageURL
action= SpeakerDetails
(SpeakerById(
speaker.speakerId))
}
}
}
Mapping concepts to code
Dienstag, 28. September 2010
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
!
id item = [self.items objectAtIndex: indexPath.row];
!
UITableViewCell *cell =
[self cellDefaultForTableView:tableView];
cell.textLabel.text = [item valueForKeyPath:@"name"];
!
NSString *imageURL = [item valueForKeyPath:@"fotourl"];
cell.imageView.image = [self getImage: imageURL
withLoadingImage:@"personLoading.png"
andErrorImage:@"personUnknown.png"];
return cell;
}
Cell Rendering
Dienstag, 28. September 2010
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
!
id item = [self.items objectAtIndex: indexPath.row];
!
UITableViewCell *cell =
[self cellDefaultForTableView:tableView];
cell.textLabel.text = [item valueForKeyPath:@"name"];
!
NSString *imageURL = [item valueForKeyPath:@"fotourl"];
cell.imageView.image = [self getImage: imageURL
withLoadingImage:@"personLoading.png"
andErrorImage:@"personUnknown.png"];
return cell;
}
Cell Rendering
tableview SpeakerList(
Speaker[] speakers)
{
title= "Speakers"
section
{
cell Default foreach
speakers as speaker
{
text= speaker.name
image= speaker.smallImageURL
action= SpeakerDetails
(SpeakerById(
speaker.speakerId))
}
}
}
Dienstag, 28. September 2010
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
id item = [self.items objectAtIndex: indexPath.row];
IPContentProvider *provider =
[IPSimpleContentProvider providerWithContent:item
andProviders:self.contentProvider.providers];
SprecherDetailsViewController *controller =
[[SprecherDetailsViewController alloc] init];
controller.contentProvider = provider;
[self.navigationController pushViewController:
controller animated: TRUE];
[controller release];
}
User Interaction
tableview SpeakerList(
Speaker[] speakers)
{
title= "Speakers"
section
{
cell Default foreach
speakers as speaker
{
text= speaker.name
image= speaker.smallImageURL
action= SpeakerDetails
(SpeakerById(
speaker.speakerId))
}
}
}
Dienstag, 28. September 2010
tableview SpeakerList(
Speaker[] speakers)
{
title= "Speakers"
section
{
cell Default foreach
speakers as speaker
{
text= speaker.name
image= speaker.smallImageURL
action= SpeakerDetails
(SpeakerById(
speaker.speakerId))
}
}
}
«DEFINE viewModule FOR SectionedView»
«FILE filenameModule()»
#import "«filenameHeader()»"
#import "NSObject+Applause.h"
«EXPAND imports»
@implementation «className()»
«EXPAND sectionCount»
«EXPAND sectionTitleHeader»
«EXPAND rowCounts»
«EXPAND cellDescriptions»
«EXPAND cellSelections»
«EXPAND staticData»
@end
«ENDFILE»
«ENDDEFINE»
Template Invocation
Dienstag, 28. September 2010
Demo
Dienstag, 28. September 2010
@HBehrens
http://HeikoBehrens.net
mobile.itemis.de
eclipse.org
code.google.com/p/applause
twitter
blog
consulting
Xtext/Xpand
applause
Dienstag, 28. September 2010

More Related Content

PDF
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
PDF
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
PDF
UIKonf App & Data Driven Design @swift.berlin
PDF
How te bring common UI patterns to ADF
PDF
Elm: give it a try
PDF
Cycle.js: Functional and Reactive
PPTX
How to Bring Common UI Patterns to ADF
PDF
"PostgreSQL and Python" Lightning Talk @EuroPython2014
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
UIKonf App & Data Driven Design @swift.berlin
How te bring common UI patterns to ADF
Elm: give it a try
Cycle.js: Functional and Reactive
How to Bring Common UI Patterns to ADF
"PostgreSQL and Python" Lightning Talk @EuroPython2014

What's hot (20)

ODP
Patterns for slick database applications
PDF
Python postgre sql a wonderful wedding
PDF
Mozilla とブラウザゲーム
PPTX
Psycopg2 - Connect to PostgreSQL using Python Script
PDF
Using web2py's DAL in other projects or frameworks
PPTX
Data visualization by Kenneth Odoh
PDF
Using Scala Slick at FortyTwo
PDF
Chaining and function composition with lodash / underscore
PDF
6. Generics. Collections. Streams
PDF
Programming with Python and PostgreSQL
PDF
mobl
PDF
Lodash js
PDF
The Ring programming language version 1.3 book - Part 83 of 88
PDF
mobl - model-driven engineering lecture
PPTX
Data Types and Processing in ES6
PDF
mobl presentation @ IHomer
PDF
RIA - Entwicklung mit Ext JS
PDF
JavaScript Fundamentals with Angular and Lodash
PPSX
NOTEPAD MAKING IN PAYTHON BY ROHIT MALAV
PDF
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
Patterns for slick database applications
Python postgre sql a wonderful wedding
Mozilla とブラウザゲーム
Psycopg2 - Connect to PostgreSQL using Python Script
Using web2py's DAL in other projects or frameworks
Data visualization by Kenneth Odoh
Using Scala Slick at FortyTwo
Chaining and function composition with lodash / underscore
6. Generics. Collections. Streams
Programming with Python and PostgreSQL
mobl
Lodash js
The Ring programming language version 1.3 book - Part 83 of 88
mobl - model-driven engineering lecture
Data Types and Processing in ES6
mobl presentation @ IHomer
RIA - Entwicklung mit Ext JS
JavaScript Fundamentals with Angular and Lodash
NOTEPAD MAKING IN PAYTHON BY ROHIT MALAV
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
Ad

Similar to MDSD for iPhone and Android (20)

PDF
Cross-Platform Native Mobile Development with Eclipse
PDF
Five android architecture
PDF
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
PDF
Practices and tools for building better API (JFall 2013)
PDF
Practices and tools for building better APIs
PDF
Android UI Tips, Tricks and Techniques
PDF
Android UI Development: Tips, Tricks, and Techniques
PDF
Rich Internet Applications con JavaFX e NetBeans
PDF
Roma introduction and concepts
PDF
#JavaFX.forReal() - ElsassJUG
PPT
Java overview the piramide of success
PDF
Java development with the dynamo framework
PDF
JavaFX for Business Application Developers
PDF
My way to clean android (EN) - Android day salamanca edition
PDF
Half way to clean architecture - Dmytro Voronkevych - Droidcon Berlin
PDF
android design pattern
PPTX
Android Study Jams - Session 2
PDF
Jlook open api server platform
PDF
DevLOVE Beautiful Development - 第一幕 陽の巻
PPTX
Pure Java RAD and Scaffolding Tools Race
Cross-Platform Native Mobile Development with Eclipse
Five android architecture
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
Practices and tools for building better API (JFall 2013)
Practices and tools for building better APIs
Android UI Tips, Tricks and Techniques
Android UI Development: Tips, Tricks, and Techniques
Rich Internet Applications con JavaFX e NetBeans
Roma introduction and concepts
#JavaFX.forReal() - ElsassJUG
Java overview the piramide of success
Java development with the dynamo framework
JavaFX for Business Application Developers
My way to clean android (EN) - Android day salamanca edition
Half way to clean architecture - Dmytro Voronkevych - Droidcon Berlin
android design pattern
Android Study Jams - Session 2
Jlook open api server platform
DevLOVE Beautiful Development - 第一幕 陽の巻
Pure Java RAD and Scaffolding Tools Race
Ad

More from Heiko Behrens (7)

PDF
MDSD on iPhone - EclipseCon 2010
PDF
iPhonical and model-driven software development for the iPhone
PDF
Building DSLs with Xtext - Eclipse Modeling Day 2009
PDF
Xtext Webinar
PDF
Xtext at Eclipse DemoCamp London in June 2009
PDF
Mastering Differentiated MDSD Requirements at Deutsche Boerse AG
PDF
Xtext - und was man damit anstellen kann
MDSD on iPhone - EclipseCon 2010
iPhonical and model-driven software development for the iPhone
Building DSLs with Xtext - Eclipse Modeling Day 2009
Xtext Webinar
Xtext at Eclipse DemoCamp London in June 2009
Mastering Differentiated MDSD Requirements at Deutsche Boerse AG
Xtext - und was man damit anstellen kann

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
Teaching material agriculture food technology
PDF
Empathic Computing: Creating Shared Understanding
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Big Data Technologies - Introduction.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Spectral efficient network and resource selection model in 5G networks
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Unlocking AI with Model Context Protocol (MCP)
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Encapsulation_ Review paper, used for researhc scholars
Mobile App Security Testing_ A Comprehensive Guide.pdf
Teaching material agriculture food technology
Empathic Computing: Creating Shared Understanding
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Weekly Chronicles - August'25 Week I
MYSQL Presentation for SQL database connectivity
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Network Security Unit 5.pdf for BCA BBA.
Advanced methodologies resolving dimensionality complications for autism neur...

MDSD for iPhone and Android

  • 1. Modellgetriebene App-Entwicklung für iPhone und Android Heiko Behrens, itemis Regionalgruppe Hamburg der GI Hamburg 24.09.2010 @HBehrens http://mobile.itemis.de Dienstag, 28. September 2010
  • 2. Modellgetriebene App-Entwicklung für iPhone und Android Dienstag, 28. September 2010
  • 3. Modellgetriebene App-Entwicklung für iPhone und Android Dienstag, 28. September 2010
  • 4. / soft·ware de·vel·op·ment / n. the set of activities that results in software products. ~ may include research, new development, modification, reuse, maintenance, or any other activities that result in software products. Dienstag, 28. September 2010
  • 6. Boring code Dienstag, 28. September 2010
  • 8. Wrong level of abstraction Dienstag, 28. September 2010
  • 9. Anatomy of Modern Software schematic code (manually written) Libraries Frameworks manually written code Dienstag, 28. September 2010
  • 11. package templates; import java.util.*; import java.io.Serializable; import javax.persistence.*; @SuppressWarnings("serial") @Entity public class Customer implements Serializable { private Long id; private String name; private Address address; private Set<Order> orders = new HashSet<Order>(); // No-arg constructor public Customer() { } @Id public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } @OneToMany public Collection<Order> getOrders() { return orders; } public void setOrders(Set<Order> orders) { this.orders = orders; } } Dienstag, 28. September 2010
  • 12. package templates; import java.io.Serializable; import java.util.*; import javax.persistence.*; @SuppressWarnings("serial") @Entity public class Customer implements Serializable { private Long id; private String name; private Address address; private Set<Order> orders = new HashSet<Order>(); // No-arg constructor public Customer() { } @Id public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } @OneToMany public Collection<Order> getOrders() { return orders; } public void setOrders(Set<Order> orders) { this.orders = orders; } } Dienstag, 28. September 2010
  • 15. This wizard whips up a complete and running legacy application with just a single click. Dienstag, 28. September 2010
  • 18. Raise the level of abstraction where possible and generate code wisely. Dienstag, 28. September 2010
  • 19. One cannot abstract away everything. Manual code is great for all the special cases and details. Dienstag, 28. September 2010
  • 20. Use the best of both worlds at the same time. Dienstag, 28. September 2010
  • 23. You’d want to core an apple... Dienstag, 28. September 2010
  • 24. ... for your kids. Dienstag, 28. September 2010
  • 25. Right tool for the job ? Dienstag, 28. September 2010
  • 26. Your trusty swiss army knife! Dienstag, 28. September 2010
  • 28. You’d want to core a few more apples... Dienstag, 28. September 2010
  • 29. ... for an apple cake. Dienstag, 28. September 2010
  • 30. Still the best tool for the job? Dienstag, 28. September 2010
  • 31. Better use this one Dienstag, 28. September 2010
  • 32. ...and this one Dienstag, 28. September 2010
  • 33. ... a DSL is ... Dienstag, 28. September 2010
  • 34. A specific tool for a specific job Dienstag, 28. September 2010
  • 35. A specific tool for a specific job Dienstag, 28. September 2010
  • 36. Use DSLs to describe the world Dienstag, 28. September 2010
  • 37. select name, salary from employees where salary > 2000 order by salary ^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}$ Dienstag, 28. September 2010
  • 39. entity Vortrag { String titel String untertitel String sprecher String beschreibung } contentprovider AllVortragItems returns Vortrag[] fetches XML from "http://spreadsheets.google.com/feeds/list/.../public/values" selects "feed.entry" tableview VortragListe(Vortrag[] items) { title= "Vorträge" section { cell Subtitle foreach items as i { text= i.titel details= i.untertitel action= VortragDetailsView( i ) } } } tabbarApplication itemisApp { button { title= "Vorträge" icon= "66-microphone.png" view= VortragListe( AllVortragItems() ) } button { title= "Referenten" icon= "person.png" view= SprecherListe( AllSprecherItems() ) } } Entities & Data Access Views & Actions Navigation Dienstag, 28. September 2010
  • 40. ... for building DSLs? Why not use a DSL... Dienstag, 28. September 2010
  • 42. Superclass Subclass Class ECore meta model LL(*) Parser Editor Model G r a m m a r Generator Runtime Dienstag, 28. September 2010
  • 43. Grammar (similar to EBNF) grammar org.xtext.example.Entity with org.eclipse.xtext.common.Terminals generate entity "http://www.xtext.org/example/Entity" Model: (types+=Type)*; Type: TypeDef | Entity; TypeDef: "typedef" name=ID ("mapsto" mappedType=JAVAID)?; JAVAID: name=ID("." ID)*; Entity: "entity" name=ID ("extends" superEntity=[Entity])? "{" (attributes+=Attribute)* "}"; Attribute: type=[Type] (many?="*")? name=ID; Dienstag, 28. September 2010
  • 44. grammar org.xtext.example.Entity with org.eclipse.xtext.common.Terminals generate entity "http://www.xtext.org/example/Entity" Model: (types+=Type)*; Type: TypeDef | Entity; TypeDef: "typedef" name=ID ("mapsto" mappedType=JAVAID)?; JAVAID: name=ID("." ID)*; Entity: "entity" name=ID ("extends" superEntity=[Entity])? "{" (attributes+=Attribute)* "}"; Attribute: type=[Type] (many?="*")? name=ID; entity Model * name: EString Type types TypeDef Entity name: EString JAVAID superEntity mappedType name: EString many: EBoolean Attribute attributes type Meta model inference Dienstag, 28. September 2010
  • 45. Let’s build a DSL for Mobile Apps Dienstag, 28. September 2010
  • 47. Anatomy of an iPhone app Table view View title Tab bar Tab bar button Name Image Speaker Title Location Session Entity Data Provider Table cell Dienstag, 28. September 2010
  • 48. Mapping concepts Table view View title Table cell Tab bar Tab bar button Entity Data Provider tabbarApplication itemisApp { button { title= "Blog" icon= "08-chat.png" view= BlogList( Blogposts() ) } button { title= "Talks" icon= "66-microphone.png" view= VortragListe( AllVortragItems() ) } button { title= "Speakers" icon= "person.png" view= SprecherListe( AllSprecherItems() ) } } Dienstag, 28. September 2010
  • 49. Mapping concepts Table view View title Table cell Tab bar Tab bar button Entity Data Provider entity BlogItem { String title String author String link String description String pubDate BlogItem subItem } entity Sprecher { String name String beschreibung String email String blog String fotourl String vortraege } entity Vortrag { String titel String untertitel String sprecher String beschreibung String zeit Vortrag fortsetzung } Dienstag, 28. September 2010
  • 50. Mapping concepts Table view View title Table cell Tab bar Tab bar button Entity Data Provider contentprovider Blogposts returns BlogItem[] fetches XML from "http://blogs.itemis.de/?showfeed=1" selects "rss.channel.item" contentprovider AllVortragItems returns Vortrag[] fetches XML from "http://spreadsheets.google.com/feeds/ list/0Au3-oaNYhfPIdEpRQWxpZnJyX2JCNUdtT1Z4M1B4SkE/1/ public/values" selects "feed.entry" Dienstag, 28. September 2010
  • 51. Mapping concepts Table view View title Table cell Tab bar Tab bar button Entity Data Provider tableview BlogList(BlogItem[] items) { title= "itemis blog" section { cell Subtitle foreach items as i { text= i.author details= i.title image= ("http://blogs.itemis.de/wp-content/ themes/itemis-WP-Theme/photos/" urlconform(i.author) ".jpg") action= BlogDetails(i) } } } Dienstag, 28. September 2010
  • 52. Type safe Produces any kind of text Can run standalone (ANT / Maven) Debugger Profiler Eclipse-based Editor Protected regions Cartridges Outlets Polymorphism Dienstag, 28. September 2010
  • 53. tableview SpeakerList( Speaker[] speakers) { title= "Speakers" section { cell Default foreach speakers as speaker { text= speaker.name image= speaker.smallImageURL action= SpeakerDetails (SpeakerById( speaker.speakerId)) } } } Mapping concepts to code Dienstag, 28. September 2010
  • 54. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ! id item = [self.items objectAtIndex: indexPath.row]; ! UITableViewCell *cell = [self cellDefaultForTableView:tableView]; cell.textLabel.text = [item valueForKeyPath:@"name"]; ! NSString *imageURL = [item valueForKeyPath:@"fotourl"]; cell.imageView.image = [self getImage: imageURL withLoadingImage:@"personLoading.png" andErrorImage:@"personUnknown.png"]; return cell; } Cell Rendering Dienstag, 28. September 2010
  • 55. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ! id item = [self.items objectAtIndex: indexPath.row]; ! UITableViewCell *cell = [self cellDefaultForTableView:tableView]; cell.textLabel.text = [item valueForKeyPath:@"name"]; ! NSString *imageURL = [item valueForKeyPath:@"fotourl"]; cell.imageView.image = [self getImage: imageURL withLoadingImage:@"personLoading.png" andErrorImage:@"personUnknown.png"]; return cell; } Cell Rendering tableview SpeakerList( Speaker[] speakers) { title= "Speakers" section { cell Default foreach speakers as speaker { text= speaker.name image= speaker.smallImageURL action= SpeakerDetails (SpeakerById( speaker.speakerId)) } } } Dienstag, 28. September 2010
  • 56. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { id item = [self.items objectAtIndex: indexPath.row]; IPContentProvider *provider = [IPSimpleContentProvider providerWithContent:item andProviders:self.contentProvider.providers]; SprecherDetailsViewController *controller = [[SprecherDetailsViewController alloc] init]; controller.contentProvider = provider; [self.navigationController pushViewController: controller animated: TRUE]; [controller release]; } User Interaction tableview SpeakerList( Speaker[] speakers) { title= "Speakers" section { cell Default foreach speakers as speaker { text= speaker.name image= speaker.smallImageURL action= SpeakerDetails (SpeakerById( speaker.speakerId)) } } } Dienstag, 28. September 2010
  • 57. tableview SpeakerList( Speaker[] speakers) { title= "Speakers" section { cell Default foreach speakers as speaker { text= speaker.name image= speaker.smallImageURL action= SpeakerDetails (SpeakerById( speaker.speakerId)) } } } «DEFINE viewModule FOR SectionedView» «FILE filenameModule()» #import "«filenameHeader()»" #import "NSObject+Applause.h" «EXPAND imports» @implementation «className()» «EXPAND sectionCount» «EXPAND sectionTitleHeader» «EXPAND rowCounts» «EXPAND cellDescriptions» «EXPAND cellSelections» «EXPAND staticData» @end «ENDFILE» «ENDDEFINE» Template Invocation Dienstag, 28. September 2010