Transcript
Page 1: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

Models To GoPeter Friese, itemis

Heiko Behrens, itemis

@peterfriese | @HBehrens@itemismobile

http://mobile.itemis.de

(c) 2010 Heiko Behrens & Peter FrieseMore info: http://www.heikobehrens.net / http://www.peterfriese.de / http://mobile.itemis.com

Page 2: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

mobile is sexy

Page 3: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

mobile is challenging

Page 4: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

diversity of platforms

Page 5: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

94 App Stores

Page 6: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

two categories

Page 7: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

countless devices

Page 8: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

How can we address this diversity?

Page 9: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

You can write amazing web apps that look exactly and behave exactly like apps on the iPhone

Steve Jobs, WWDC 2007

Page 10: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

MOBILE WEB

Page 11: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

server-side web

Device

Web Browser

Backend

Web Serverexecutes application

logic

Files Database

client-side web

Device

Web Browser

Backend

DatabaseFiles

JavaScriptexecutes application logic

Page 12: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

hybrid app

Device

Native App

Browserexecutes JavaScript

JavaScript Bridge

Request Interceptor

Interpreter

Backend

Page 13: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

interpreted app

Device

Native App

Application Script

interpreter

Backend

Files

Database

Page 14: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

Generator Input

Device

Native App

Logic

Backend

Files

Database

Logic

Files

Database

DatabaseFiles

Modeldescribes logic andcomplete system

Generator

generated app

Page 15: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

gain speed through restrictions

Page 16: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project
Page 17: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project
Page 18: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

Lists Details Custom

Page 19: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

http://www.flickr.com/photos/minifig/3174009125/

analyzing the problem

Page 20: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

Anatomyof these apps

Page 21: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

Cells

View

Navigation

NameImage

Speaker

TitleLocation

Session

Entity

Data Provider

Page 22: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project
Page 23: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

demo

Page 24: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

getting real

Page 25: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

tabbarApplication itemisApp { button { title= "Tuesday" icon= "calendar.png" view= SessionList( SessionsByDay("0") ) }

button { title= "Wednesday" icon= "calendar.png" view= SessionList( SessionsByDay("1") ) } button { title= "Thursday" icon= "calendar.png" view= SessionList( SessionsByDay("2") ) } button { title= "Speakers" icon= "person.png" view= SpeakersList( AllSpeakers() ) }}

Page 26: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

tabbarApplication itemisApp { button { title= "Tuesday" icon= "calendar.png" view= SessionList( SessionsByDay("0") ) }

button { title= "Wednesday" icon= "calendar.png" view= SessionList( SessionsByDay("1") ) } button { title= "Thursday" icon= "calendar.png" view= SessionList( SessionsByDay("2") ) } button { title= "Speakers" icon= "person.png" view= SpeakersList( AllSpeakers() ) }}

Page 27: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

-(UIViewController*)createController {! itemisAppProviders *providers = [[[itemisAppProviders alloc] init] autorelease];! UITabBarController *result = [[UITabBarController alloc] init];! NSMutableArray *controllers = [NSMutableArray array];!! UIViewController<IPUIView> *controller;! UINavigationController *navController;! IPContentProvider *contentProvider;

! // controller for @"Tuesday"! contentProvider = [providers providerForSessionsByDay: @"0"];!! controller = [[SessionListViewController alloc] init];! [controller setContentProvider: contentProvider];! controller.tabBarItem.title = @"Tuesday";! controller.tabBarItem.image = [UIImage imageNamed:@"calendar.png"];! navController = [[UINavigationController alloc] initWithRootViewController:controller];! [controllers addObject: navController];! [controller release];! [navController release];

!! // controller for @"Wednesday"! contentProvider = [providers providerForSessionsByDay: @"1"];!! controller = [[SessionListViewController alloc] init];! [controller setContentProvider: contentProvider];! controller.tabBarItem.title = @"Wednesday";! controller.tabBarItem.image = [UIImage imageNamed:@"calendar.png"];! navController = [[UINavigationController alloc] initWithRootViewController:controller];! [controllers addObject: navController];! [controller release];! [navController release];

!! // controller for @"Thursday"! contentProvider = [providers providerForSessionsByDay: @"2"];!! controller = [[SessionListViewController alloc] init];! [controller setContentProvider: contentProvider];! controller.tabBarItem.title = @"Thursday";! controller.tabBarItem.image = [UIImage imageNamed:@"calendar.png"];! navController = [[UINavigationController alloc] initWithRootViewController:controller];! [controllers addObject: navController];! [controller release];! [navController release];

!! // controller for @"Speakers"! contentProvider = [providers providerForAllSpeakers];!! controller = [[SpeakersListViewController alloc] init];! [controller setContentProvider: contentProvider];! controller.tabBarItem.title = @"Speakers";! controller.tabBarItem.image = [UIImage imageNamed:@"person.png"];! navController = [[UINavigationController alloc] initWithRootViewController:controller];! [controllers addObject: navController];! [controller release];! [navController release];

! result.viewControllers = controllers;! return result;}

Page 28: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

-(UIViewController*)createController {! itemisAppProviders *providers = [[[itemisAppProviders alloc] init] autorelease];! UITabBarController *result = [[UITabBarController alloc] init];! NSMutableArray *controllers = [NSMutableArray array];!! UIViewController<IPUIView> *controller;! UINavigationController *navController;! IPContentProvider *contentProvider;

! // controller for @"Tuesday"! contentProvider = [providers providerForSessionsByDay: @"0"];!! controller = [[SessionListViewController alloc] init];! [controller setContentProvider: contentProvider];! controller.tabBarItem.title = @"Tuesday";! controller.tabBarItem.image = [UIImage imageNamed:@"calendar.png"];! navController = [[UINavigationController alloc] initWithRootViewController:controller];! [controllers addObject: navController];! [controller release];! [navController release];

!! // controller for @"Wednesday"! contentProvider = [providers providerForSessionsByDay: @"1"];!! controller = [[SessionListViewController alloc] init];! [controller setContentProvider: contentProvider];! controller.tabBarItem.title = @"Wednesday";! controller.tabBarItem.image = [UIImage imageNamed:@"calendar.png"];! navController = [[UINavigationController alloc] initWithRootViewController:controller];! [controllers addObject: navController];! [controller release];! [navController release];

!! // controller for @"Thursday"! contentProvider = [providers providerForSessionsByDay: @"2"];!! controller = [[SessionListViewController alloc] init];! [controller setContentProvider: contentProvider];! controller.tabBarItem.title = @"Thursday";! controller.tabBarItem.image = [UIImage imageNamed:@"calendar.png"];! navController = [[UINavigationController alloc] initWithRootViewController:controller];! [controllers addObject: navController];! [controller release];! [navController release];

!! // controller for @"Speakers"! contentProvider = [providers providerForAllSpeakers];!! controller = [[SpeakersListViewController alloc] init];! [controller setContentProvider: contentProvider];! controller.tabBarItem.title = @"Speakers";! controller.tabBarItem.image = [UIImage imageNamed:@"person.png"];! navController = [[UINavigationController alloc] initWithRootViewController:controller];! [controllers addObject: navController];! [controller release];! [navController release];

! result.viewControllers = controllers;! return result;}

Page 29: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

«Xpand»

Page 30: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

«DEFINE moduleFile FOR Application»«FILE filenameApplicationDelegateModule()»#import "«filenameApplicationDelegateHeader()»"#import "IPUIView.h"#import "«filenameCentralProvidersHeader()»"

«EXPAND importStatements-»

@implementation «applicationDelegateClassname()»

@synthesize window, rootController;

-(UIViewController*)createController { «centralProvidersClassName()» *providers = [[[«centralProvidersClassName()» alloc] init] autorelease]; UITabBarController *result = [[UITabBarController alloc] init]; NSMutableArray *controllers = [NSMutableArray array]; UIViewController<IPUIView> *controller; UINavigationController *navController; IPContentProvider *contentProvider;

«EXPAND barControllerInstance FOREACH buttons»

result.viewControllers = controllers; return result;}

- (void)applicationDidFinishLaunching:(UIApplication *)application { self.rootController = [self createController]; [window addSubview: [self.rootController view]]; [window makeKeyAndVisible];}

- (void)dealloc { self.rootController = nil; [window release]; [super dealloc];}

@end«ENDFILE»«ENDDEFINE»

Page 31: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

«DEFINE moduleFile FOR Application»«FILE filenameApplicationDelegateModule()»#import "«filenameApplicationDelegateHeader()»"#import "IPUIView.h"#import "«filenameCentralProvidersHeader()»"

«EXPAND importStatements-»

@implementation «applicationDelegateClassname()»

@synthesize window, rootController;

-(UIViewController*)createController { «centralProvidersClassName()» *providers = [[[«centralProvidersClassName()» alloc] init] autorelease]; UITabBarController *result = [[UITabBarController alloc] init]; NSMutableArray *controllers = [NSMutableArray array]; UIViewController<IPUIView> *controller; UINavigationController *navController; IPContentProvider *contentProvider;

«EXPAND barControllerInstance FOREACH buttons»

result.viewControllers = controllers; return result;}

- (void)applicationDidFinishLaunching:(UIApplication *)application { self.rootController = [self createController]; [window addSubview: [self.rootController view]]; [window makeKeyAndVisible];}

- (void)dealloc { self.rootController = nil; [window release]; [super dealloc];}

@end«ENDFILE»«ENDDEFINE»

Page 32: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

«DEFINE barControllerInstance FOR TabbarButton» «IF view.provider != null» // controller for «this.title.expression('', '')» contentProvider = «view.provider.contentProvider('providers', '', '')»; «ENDIF» controller = [[«view.view.className()» alloc] init]; [controller setContentProvider: contentProvider]; controller.tabBarItem.title = «title.expression('', '')»; controller.tabBarItem.image = [UIImage imageNamed:«this.icon.expression('','')»]; navController = [[UINavigationController alloc] initWithRootViewController:controller]; [controllers addObject: navController]; [controller release]; [navController release];«ENDDEFINE»

Page 33: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

tool integration

Page 34: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

demo 2

Page 35: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

Objective-C

Simulator

Device

Java

Device

Simulator

DSLdescribes application

developer’s point of view

Page 36: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

Grammardescribes DSL

«Xpand»Parser

Editor

TemplatesiPhone

TemplatesAndroid

EMF MM

toolsmith’s point of view

Page 37: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

Objective-C

Simulator

Device

Java

Device

Simulator

DSLdescribes application

Grammardescribes DSL

«Xpand»Parser

Editor

TemplatesiPhone

TemplatesAndroid

EMF MM

applauseAPPlause

http://code.google.com/p/applause/

Page 38: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project
Page 39: Models To Go: How We Built a DSL for Mobile Apps With Tools From the Eclipse Modeling Project

http://mobile.itemis.de

@peterfriese | http://peterfriese.de@hbehrens |!http://heikobehrens.net


Top Related