Once CODE to rule them all

2,823 views

Published on

DSLs in Mobile application development, using XText and Applause framework as example.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,823
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
30
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \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
  • \n
  • \n
  • Once CODE to rule them all

    1. 1. One CODE to rule them allDSLs and Mobile App Developmentpresented by Herman Lintvelt
    2. 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. 3. Poll What is the biggest frustration you have whendeveloping mobile applications for smartphones?
    4. 4. Challenges in Mobile App Development Can we have it for BlackBerry too?
    5. 5. Challenges in Mobile App DevelopmentDo we really have to do this again?
    6. 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. 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)
    8. 8. Towards a CODE solution
    9. 9. Manually written code Frameworks Libraries
    10. 10. Manually written app code Manually written schematic/scaffolding code Frameworks Libraries
    11. 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. 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. 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 codeApp 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 codeApp Two iOS Frameworks Android Frameworks iOS Libraries Android Libraries
    14. 14. What’s wrong with this picture? • Repetition, Repetition, Repetition • Mostly Manual • Accidental Complexity • UI code is difficult
    15. 15. What If?
    16. 16. What If?We code each app ONCE
    17. 17. What If? We code each app ONCE ANDWe have control over the native code
    18. 18. What If? We code each app ONCE AND We have control over the native code ANDExperience gained with each app enhances overall quality of native code
    19. 19. Scenario 3: Multiple apps for multiple platforms Manually written app codeApp One iOS Generated app code Android Generated app code iOS Scaffolding code Android Scaffolding code iOS Frameworks Android Frameworks iOS Libraries Android LibrariesApp Two Manually written app code
    20. 20. IntroducingDomain Specific Languages (DSL)
    21. 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. 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. 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)
    24. 24. Introducing the ApplauseFramework
    25. 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 GeneratediOS Generated app Android Generated app code iOS Scaffolding code Android code Scaffolding code iOS Android Frameworks Frameworks iOS Libraries Android Libraries
    26. 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. 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)
    28. 28. Explore by Example• SASSI Pocket Guide app (wwfsassi.co.za)
    29. 29. First we need some data• Google Docs to the rescue
    30. 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 HEntity IMG Note Tab Bar All Green Orange Red Data Provider Tab Bar Button
    31. 31. Mapping concepts Entity Data Provider View Title Table View Table Cell Tab Bar Tab Bar Button
    32. 32. Mapping concepts Entity Data Provider View Title Table View Table Cell Tab Bar Tab Bar Button
    33. 33. Mapping concepts Entity Data Provider View Title Table View Table Cell Tab Bar Tab Bar Button
    34. 34. Mapping concepts Entity Data Provider View Title Table View Table Cell Tab Bar Tab Bar Button
    35. 35. The flow of things Applause DSL iOS Code Generation templates
    36. 36. The flow of things Generated iOS Application Code
    37. 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. 38. Retrospective• Did this give us what we want?• Inspect & Adapt • enhance scaffolding templates • enhance DSL
    39. 39. 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)
    40. 40. 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
    41. 41. 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
    42. 42. Thanks• Thanks for attending• Feel free to email me at: • herman@polymorph.co.za• Have fun creating your own coding language

    ×