Streamlining Python Development: A Guide to a Modern Project Setup
Once CODE to rule them all
1. One CODE
to rule
them
all
DSLs and Mobile App Development
presented by Herman Lintvelt
2. Agenda
• Challenges in Mobile App development
• Possible Solutions
• Introducing Domain Specific Languages (DSL)
• What & Why
• Applause Framework
• XText
• Example: SASSI Pocketguide App
• Next steps
3. Poll
What is the biggest frustration you have when
developing mobile applications for smartphones?
6. Multi-platform Challenge
• For a while iPhone was “the one and only”
• Increasingly clients want to roll out apps to multiple
smart phone platforms (Android, Blackberry)
• BUT
• Clients do not necessarily want to pay extra full cost
for each platform
• It’s boring and inefficient to duplicate effort for each
platform
7. Possibilities
• Numerous frameworks / tools out there to help
develop mobile apps for multiple platforms:
• PhoneGap, Appcelerator, RAMP, Rhomobile, J2ME
Polish, etc.
• Does have drawbacks:
• limited functionality: cannot access all the
functionality of each mobile platform
• for some: web-driven content (constant use of
expensive bandwidth)
10. Manually written app code
Manually written
schematic/scaffolding code
Frameworks
Libraries
11. Scenario 1: Develop same app for multiple platforms
Manually written app code Manually written app code
Manually written Manually written
schematic/scaffolding code schematic/scaffolding code
iOS Frameworks Android Frameworks
iOS Libraries Android Libraries
iOS Android
12. Scenario 2: Develop second app on same platform
Manually written app code
Manually written
schematic/scaffolding code
iOS App One
iOS Frameworks
iOS Libraries
Manually written app code
Manually written
schematic/scaffolding code
iOS App Two
iOS Frameworks
iOS Libraries
13. Scenario 3: Multiple apps for multiple platforms
Manually written app code Manually written app code
Manually written Manually written
schematic/scaffolding code schematic/scaffolding code
App One iOS Frameworks Android Frameworks
iOS Libraries Android Libraries
Manually written app code Manually written app code
Manually written Manually written
schematic/scaffolding code schematic/scaffolding code
App Two iOS Frameworks Android Frameworks
iOS Libraries Android Libraries
14. What’s wrong with this picture?
• Repetition,
Repetition,
Repetition
• Mostly Manual
• Accidental
Complexity
• UI code is difficult
17. What If?
We code each app ONCE
AND
We have control over the native code
18. What If?
We code each app ONCE
AND
We have control over the native code
AND
Experience gained with each app enhances
overall quality of native code
19. Scenario 3: Multiple apps for multiple platforms
Manually written app code
App One
iOS Generated app code Android Generated app code
iOS Scaffolding code Android Scaffolding code
iOS Frameworks Android Frameworks
iOS Libraries Android Libraries
App Two
Manually written app code
21. What is a DSL?
• Programming/Specification language
dedicated to specific problem domain
• e.g. Logo, Mathematica, SQL, regular
expressions, GraphViz, XSLT, Business Rules
Engines, UnrealScript, Lua
• Java, Objective-C: general purpose
languages
22. Why use a DSL?
• allows solutions to be expressed more
clearly & closer to domain
• enhances understanding and
communication
• allows validation at domain level
• self-documenting
23. Mobile App DSL
• It is possible to define a DSL for the Mobile
application domain
• Examples:
• RAMP uses a custom DSL
• Applause (now applitude)
25. What is it?
• “(XText) DSL for creating mobile apps”
• Use code generation (via XPand) to generate for
multiple platforms (iOS and Android)
DSL Manually written app
Generated
iOS Generated app Android Generated app
code
iOS Scaffolding code Android code
Scaffolding code
iOS Android
Frameworks Frameworks
iOS Libraries Android Libraries
26. Applause Background
• Developed by Heiko Behrens, Peter Friese
• from Itemis AG (www.itemis.com)
• http://code.google.com/applause
• Reworked into: applitude
• http://applitude.org/
• Makes use of XText and Xpand Eclipse
projects
27. XText : Quick Intro
• language development framework for DSL (or even full-blown
GPL)
• http://www.eclipse.org/XText
• creates Eclipse-based development environment for your DSL
• it provides way (i.e. its own DSL) to describe your language, then
gives:
• parser
• type-safe abstract syntax tree (AST)
• serializer
• code formatter
• scoping, linking, compiler checks, validation
• code generator or interpreter
• Eclipse IDE for your language
• Highly configurable (using Google Guice)
30. App Anatomy
iPhone 10:15 PM
View Title
SASSI Pocket Guide
Fish A
IMG
Note
Table View
IMG
Fish B
Note
Fish IMG
Fish C Table Cell
Note
FishName
status Fish D
note IMG
Note
IMG
Fish E
Note
IMG
Fish F
Note
IMG
Fish G
Note
Fish H
Entity IMG
Note Tab Bar
All Green Orange Red
Data Provider Tab Bar Button
31. Mapping concepts
Entity
Data Provider
View Title
Table View
Table Cell
Tab Bar
Tab Bar Button
32. Mapping concepts
Entity
Data Provider
View Title
Table View
Table Cell
Tab Bar
Tab Bar Button
33. Mapping concepts
Entity
Data Provider
View Title
Table View
Table Cell
Tab Bar
Tab Bar Button
34. Mapping concepts
Entity
Data Provider
View Title
Table View
Table Cell
Tab Bar
Tab Bar Button
35. The flow of things
Applause DSL
iOS Code Generation templates
36. The flow of things
Generated iOS Application Code
37. The flow of things
iPhone 10:15 PM
SASSI Pocket Guide
IMG
Fish A
Note
IMG
Fish B
Note
IMG
Fish C
Note
IMG
Fish D
Note
IMG
Fish E
Note
IMG
Fish F
Note
IMG
Fish G
Note
IMG
Fish H
Note
All Green Orange Red
38.
39. Retrospective
• Did this give us what we want?
• Inspect & Adapt
• enhance scaffolding templates
• enhance DSL
40. Next Steps
• Investigate iPhonical
• http://code.google.com/p/iphonical/
• Also XText based (similar to Applause)
• Currently focussed on CRUD-based apps
• Generate Titanium Mobile javascript (i.e.
Appcelerator do multi-platform abstraction)
41. Next Steps
• DSL for your business domain
• Differentiate between enterprise business
domain and the business of building apps for
various clients
• e.g. Car Telematics DSL vs. Applause DSL
• Other uses?
• Specification (BDD?)
• Testing
42. iOS User Group
Cape Town
• Please email me: herman@polymorph.co.za
• Indicate if you want to:
• a) help organise
• b) just want to attend
43. Thanks
• Thanks for attending
• Feel free to email me at:
• herman@polymorph.co.za
• Have fun creating your own coding
language
Editor's Notes
\n
\n
\n
\n
\n
\n
RAMP: Virtual Mobile Technologies\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
MWE2: Modeling workflow engine 2\ntextual approach much easier to implement & use than GUI\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Specification: DSL done in-house, build of native app from that outsourced\n