cross-platform, native mobile development with a dsl

32
Cross-Platform, Native Mobile Development with a DSL Heiko Behrens, Peter Friese Dienstag, 13. September 2011

Upload: peter-friese

Post on 15-Jan-2015

1.668 views

Category:

Technology


2 download

DESCRIPTION

You can build native apps for iOS, Android, Windows Phone 7, and web apps from a single source with tools of the Eclipse ecosystem. We will present a domain-specific language we used to create data-oriented apps and avoid manually porting applications to other platforms. Still, you get fully readable, extensible source code of the respective target such as Objective-C, Java, C# or Python.

TRANSCRIPT

Page 1: Cross-Platform, Native Mobile Development with a DSL

Cross-Platform, Native Mobile Development with a DSL

Heiko Behrens, Peter Friese

Dienstag, 13. September 2011

Page 2: Cross-Platform, Native Mobile Development with a DSL

Cross-Platform, Native Mobile Developmentwith a DSL

@HBehrens@PeterFriese

Dienstag, 13. September 2011

Page 3: Cross-Platform, Native Mobile Development with a DSL

@moskovich: “Your mobile phone has more computing power than all of NASA in 1969.

NASA put a man on the moon...Dienstag, 13. September 2011

Page 4: Cross-Platform, Native Mobile Development with a DSL

...we put a bird into pigs.”Dienstag, 13. September 2011

Page 5: Cross-Platform, Native Mobile Development with a DSL

countless devices

Dienstag, 13. September 2011

Page 6: Cross-Platform, Native Mobile Development with a DSL

diversity of platforms

Dienstag, 13. September 2011

Page 7: Cross-Platform, Native Mobile Development with a DSL

Javapublic class SpeakersList extends GenericListActivity<Speaker> {

List<Speaker> speakers;

@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

setTitle("Speakers");

speakers = getItemsFromProvider();

ArrayList<AbstractRowAdapter> rowAdapters = new ArrayList<AbstractRowAdapter>();

Iterable<Speaker> items1 = speakers; for (Speaker i : items1) rowAdapters.add(new Cell1(i));

setListAdapter(new GenericItemAdapter(this, rowAdapters)); finishCreation();

}

Dienstag, 13. September 2011

Page 8: Cross-Platform, Native Mobile Development with a DSL

C#public partial class SpeakerDetailsDetailsView : PhoneApplicationPage{ public SpeakerDetailsDetailsView() { InitializeComponent(); }

protected override void OnNavigatedTo(NavigationEventArgs e) { string selectedIndex = ""; if (NavigationContext.QueryString.TryGetValue("itemByIndex", out selectedIndex)) { int index = int.Parse(selectedIndex); DataContext = App.RootViewModelProvider.BlogpostsModelProvider().BlogItems[index]; } }}

Dienstag, 13. September 2011

Page 9: Cross-Platform, Native Mobile Development with a DSL

Objective-C@implementation SpeakersListViewController

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if(section == 0) { return [[[contentProvider valueForKeyPath:@"content"] asArray] count]; } else return 0;}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { id item = [self.items objectAtIndex: indexPath.row]; IPContentProvider *provider = [(itemisAppProviders*)contentProvider.providers

providerForSpeakerByName: [item valueForKeyPath:@"name"]]; SpeakerDetailsViewController *controller = [[SpeakerDetailsViewController alloc] init]; controller.contentProvider = provider; [self.navigationController pushViewController: controller animated: TRUE]; [controller release];}

Dienstag, 13. September 2011

Page 10: Cross-Platform, Native Mobile Development with a DSL

HTML{% extends "generated/application.html" %}{% block title%}Speakers{% endblock %}{% block content_class %}table list{% endblock %}

{% block content %}<ul>{% for s in data|to_list %} <li> {% url views.SpeakerDetailsBySpeakerByName s.name|urlencode as url %} <a href="{{ url }}"> <div class="cell_text">{{s.name|safe}}</div> </a> </li>{% endfor %}</ul>{% endblock %}

Dienstag, 13. September 2011

Page 11: Cross-Platform, Native Mobile Development with a DSL

server-side web

Device

Web Browser

Backend

Web Serverexecutes application

logic

Files Database

Dienstag, 13. September 2011

Page 12: Cross-Platform, Native Mobile Development with a DSL

server-side web

Geräte, Plattformen, Versionen - neue Herausforderungen im mobilen MarktJan Webering, Roland GülleGutenbergsaal III

5 Things your Company can do to speed up its mobile WebsiteThomas SchlagenhauferGutenbergsaal III

Tuesday15.00

Tuesday11.45

Dienstag, 13. September 2011

Page 13: Cross-Platform, Native Mobile Development with a DSL

client-side web

Device

Web Browser

Backend

DatabaseFiles

JavaScriptexecutes application logic

Dienstag, 13. September 2011

Page 14: Cross-Platform, Native Mobile Development with a DSL

JavaScript Data Binding mit jQuery MobileTobias Bosch, Stefan ScheidtWatfordsaal

Lessons Learned: Mobile Business-Webanwendungen mit jQuery MobileTimo ElbertWatfordsaal

Wednesday17.15

Wednesday10.00

client-side web

Dienstag, 13. September 2011

Page 15: Cross-Platform, Native Mobile Development with a DSL

hybrid app

Device

Native App

Browserexecutes JavaScript

JavaScript Bridge

Request Interceptor

Interpreter

Backend

Dienstag, 13. September 2011

Page 16: Cross-Platform, Native Mobile Development with a DSL

Cross-Plattform Mobile Development mit Sencha Touch und PhoneGapStefan KolbWatfordsaal

Wednesday16.00

hybrid app

Dienstag, 13. September 2011

Page 17: Cross-Platform, Native Mobile Development with a DSL

interpreted app

Device

Native App

Application Script

interpreter

Backend

Files

Database

Dienstag, 13. September 2011

Page 18: Cross-Platform, Native Mobile Development with a DSL

hybrid app

Dienstag, 13. September 2011

Page 19: Cross-Platform, Native Mobile Development with a DSL

Generator Input

Device

Native App

Logic

Backend

Files

Database

Logic

Files

Database

DatabaseFiles

Modeldescribes logic andcomplete system

Generator

generated app

Dienstag, 13. September 2011

Page 20: Cross-Platform, Native Mobile Development with a DSL

App Anatomy 101

Dienstag, 13. September 2011

Page 21: Cross-Platform, Native Mobile Development with a DSL

App Anatomy 101

ContentProviders

Sessiontitleroom

Entities

Navigation

Cells

Views

Dienstag, 13. September 2011

Page 22: Cross-Platform, Native Mobile Development with a DSL

DSL for mobiletabbarApplication itemisApp {

button { title="News" icon="calendar.png" view=EventList( CurrentTimeline() ) }

button { title= "itemis" icon= "itemis.png" view= OfficeList( CompanyDescription() ) }

button { title= "Carreer" icon= "trophy.png" view= CareerView( CareerData() ) } }

Dienstag, 13. September 2011

Page 23: Cross-Platform, Native Mobile Development with a DSL

Demo :)

Dienstag, 13. September 2011

Page 24: Cross-Platform, Native Mobile Development with a DSL

«Xpand»

Dienstag, 13. September 2011

Page 25: Cross-Platform, Native Mobile Development with a DSL

Objective-C

Simulator

Device

Java

Device

Simulator

DSLdescribes application

developer’s point of view

Dienstag, 13. September 2011

Page 26: Cross-Platform, Native Mobile Development with a DSL

Grammardescribes DSL

«Xpand»Parser

Editor

TemplatesiPhone

TemplatesAndroid

EMF MM

toolsmith’s point of view

Dienstag, 13. September 2011

Page 27: Cross-Platform, Native Mobile Development with a DSL

Objective-C

Simulator

Device

Java

Device

Simulator

DSLdescribes application

Grammardescribes DSL

«Xpand»Parser

Editor

TemplatesiPhone

TemplatesAndroid

EMF MM

applausehttp://applause.github.com

Dienstag, 13. September 2011

Page 28: Cross-Platform, Native Mobile Development with a DSL

action = { log(“before”); UpdateWorkflow(item.Box.JobId, userInput("Cancel")); refresh(); log(“after”);}

reduced complexityuser interaction

server round trip

Dienstag, 13. September 2011

Page 29: Cross-Platform, Native Mobile Development with a DSL

action = { log(“before”); UpdateWorkflow(item.Box.JobId, userInput("Cancel")); refresh(); log(“after”);}

[functions log: @"before"];[provider userInputOn:@"Cancel" promises:^(id promise){ IPContentProvider *provider = [providers providerForUpdateWorkflow:content.Box.JobId andUserComment:promise]; [functions provider: provider promises:^(id promise){ [functions refreshPromises:^(id promise){ [functions log: @"after"]; }]; }];}];

Dienstag, 13. September 2011

Page 30: Cross-Platform, Native Mobile Development with a DSL

paradigm agnostic

Dienstag, 13. September 2011

Page 31: Cross-Platform, Native Mobile Development with a DSL

More Demo :))

Dienstag, 13. September 2011

Page 32: Cross-Platform, Native Mobile Development with a DSL

@HBehrenshttp://HeikoBehrens.net getBeamApp.com

twitterblog

CEO/Founder

@PeterFriesehttp://PeterFriese.de

twitterblog

Dienstag, 13. September 2011