USE RUBY TO WRITE (AND TEST) YOUR    NEXT ANDROID APPJoel BylerSoftware Craftsman@joelbylerJune 1, 2013Pittsburgh TechFest...
WHO AM I?    JOEL BYLER Software Craftsman Organizer for CleRb Enterprise Java Developer Relatively new to Ruby ... a...
Saturday, June 1, 13
NEW TO ANDROID AND RUBY??? Software CraftsmanshipReduce risk with TDD / ATDD <3 Ruby and want to learn more <3 Mobile ...
RUBY ON ANDROID USING RUBOTOJRuby optimized for the Android OS JRuby is a JVM language Android uses something like the ...
IRB ON YOUR ANDROID DEVICE Interactive Ruby Shell Edit and run scripts in Android demo...Saturday, June 1, 13
PERFORMANCE CONSIDERATIONSOther than initial startup to loadJRuby, the performance of the appappears to be as good as many...
RUBOTO CORE A separate app available on theGoogle Play Store Allows Ruboto Runtime (JRubyon Dalvik VM) to be shared An ...
HOW DOES THISMAKE YOU FEEL?This is what your users willsee if they don’t already havethe Ruboto Core installedUsing the --...
CREATE A NEW PROJECTRuboto Application Generator$ ruboto gen app --package com.leandog.mastermind.ruboto--name MasterMindR...
RUBOTO CLASS GENERATORRuboto Class Generator$ ruboto gen class Activity --name MasterMindMainActivityThis will generate co...
YOUR GENERATED APPSaturday, June 1, 13
YOUR GENERATED CODE (RUBY .RB)Saturday, June 1, 13
YOUR GENERATED TEST (ALSO .RB)Saturday, June 1, 13
RAKE INSTEAD OF ANT$ rake install startInstall the project on a device or emulator and startit running.$ ant debug$ adb in...
ADD IN THE ATDD$ gem install testgenThis is one of @chzy s testing gems$ testgen project yourapp --with-gametelThis will a...
NOW FOR SOME UNIT TESTS$ mkdir spec This is where your specs will liveAdd rspec to Rakefile (created by testgen)Saturday, J...
UNIT TESTINGUse rspec to test your ruby code, just like younormally would.rspecJUnit 3rake specSaturday, June 1, 13
INTEGRATION TEST?Instruments and installs app on device when runningrake testsimilar to ActivityInstrumentationTestCase2Sa...
ACCEPTANCE TESTINGFeature: Input ScreenScenario: Welcome the userWhen the application launchesThen I see "Enter four numbe...
YOUR RUBOTO CLASS FILES Theyre just .rb files Allows you to make changes without a fullrebuild fast feedback Ruboto use...
QUICK TOUR OF THE CODE* Time permittingSaturday, June 1, 13
Saturday, June 1, 13
THE RUBOTO COMMUNITY IS GROWINGSome of these projects are still young or have a smalluser base.- They will probably contin...
CONCLUSIONRuboto is a great Open Source project with agrowing community that promises to get evenbetter.Yes, it does incre...
RESOURCESSample Codehttps://github.com/joelbyler/Ruboto-MasterMindRubotohttp://ruboto.org/ATDD Training Resourcehttps://le...
DOMO ARIGATO MR. ROBOTO!Fun fact:domo arigato actually means"Thanks a lot!"in Japanesehttp://en.wikipedia.org/wiki/Domo_ar...
THAT’S A WRAP!Joel Byler@joelbylerSaturday, June 1, 13
COME FLOAT WITH US!Located on a 10,000 square foot boat on theCleveland waterfront, our team exemplifieshow Agile values &...
Upcoming SlideShare
Loading in …5
×

Use Ruby to Write (and Test) Your Next Android App

11,625 views

Published on

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

No Downloads
Views
Total views
11,625
On SlideShare
0
From Embeds
0
Number of Embeds
6,140
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Use Ruby to Write (and Test) Your Next Android App

  1. 1. USE RUBY TO WRITE (AND TEST) YOUR NEXT ANDROID APPJoel BylerSoftware Craftsman@joelbylerJune 1, 2013Pittsburgh TechFestLa Roche CollegeSaturday, June 1, 13
  2. 2. WHO AM I? JOEL BYLER Software Craftsman Organizer for CleRb Enterprise Java Developer Relatively new to Ruby ... and AndroidSaturday, June 1, 13
  3. 3. Saturday, June 1, 13
  4. 4. NEW TO ANDROID AND RUBY??? Software CraftsmanshipReduce risk with TDD / ATDD <3 Ruby and want to learn more <3 Mobile apps, who doesn’t?Warning: this may turn out to be a lot of code to absorb in a shortamount of time. Slides and code will be made publicly availableSaturday, June 1, 13
  5. 5. RUBY ON ANDROID USING RUBOTOJRuby optimized for the Android OS JRuby is a JVM language Android uses something like the JVMbut actually Dalvik VM=+<<< MAGIC >>>Saturday, June 1, 13
  6. 6. IRB ON YOUR ANDROID DEVICE Interactive Ruby Shell Edit and run scripts in Android demo...Saturday, June 1, 13
  7. 7. PERFORMANCE CONSIDERATIONSOther than initial startup to loadJRuby, the performance of the appappears to be as good as manynative Android appsSaturday, June 1, 13
  8. 8. RUBOTO CORE A separate app available on theGoogle Play Store Allows Ruboto Runtime (JRubyon Dalvik VM) to be shared An alternative would be to usethe --with-jruby optionDecisions, decisions...Saturday, June 1, 13
  9. 9. HOW DOES THISMAKE YOU FEEL?This is what your users willsee if they don’t already havethe Ruboto Core installedUsing the --with-jrubyoption will add ~10mbto the size of your apporSaturday, June 1, 13
  10. 10. CREATE A NEW PROJECTRuboto Application Generator$ ruboto gen app --package com.leandog.mastermind.ruboto--name MasterMindRuboto --target android-15--with-jruby --path=RubotoMasterMindThis will generate application withWhat hath Matz wrought? sample code.Saturday, June 1, 13
  11. 11. RUBOTO CLASS GENERATORRuboto Class Generator$ ruboto gen class Activity --name MasterMindMainActivityThis will generate code for the activity and add it tothe project manifest.You can also use this to generate aBroadcastReceiver or Service classSaturday, June 1, 13
  12. 12. YOUR GENERATED APPSaturday, June 1, 13
  13. 13. YOUR GENERATED CODE (RUBY .RB)Saturday, June 1, 13
  14. 14. YOUR GENERATED TEST (ALSO .RB)Saturday, June 1, 13
  15. 15. RAKE INSTEAD OF ANT$ rake install startInstall the project on a device or emulator and startit running.$ ant debug$ adb install example.apk$ adb shell am start -n com.foo.bar...$ rake update_scriptsInstall the project on a device or emulator and startit running.$ adb install example.apk$ rake -T List other available rake tasksSaturday, June 1, 13
  16. 16. ADD IN THE ATDD$ gem install testgenThis is one of @chzy s testing gems$ testgen project yourapp --with-gametelThis will add everything you need to use cucumberto test your Ruboto appSaturday, June 1, 13
  17. 17. NOW FOR SOME UNIT TESTS$ mkdir spec This is where your specs will liveAdd rspec to Rakefile (created by testgen)Saturday, June 1, 13
  18. 18. UNIT TESTINGUse rspec to test your ruby code, just like younormally would.rspecJUnit 3rake specSaturday, June 1, 13
  19. 19. INTEGRATION TEST?Instruments and installs app on device when runningrake testsimilar to ActivityInstrumentationTestCase2Saturday, June 1, 13
  20. 20. ACCEPTANCE TESTINGFeature: Input ScreenScenario: Welcome the userWhen the application launchesThen I see "Enter four numbers below and submit your guess"Scenario: User can guessGiven I enter 4 numbersWhen I press the submit buttonThen I see "Nice guess!"rake featuresCucumberGametelBrazenheadADB gemclass MainScreeninclude Gameteltext(:number1, :index => 0)text(:number2, :index => 1)text(:number3, :index => 2)text(:number4, :index => 3)def guess (first, second, third, forth)number1 = first.to_snumber2 = second.to_snumber3 = third.to_snumber4 = forth.to_sendendThen(/^I enter 4 numbers$/) doon(MainScreen).guess 1, 2, 3, 4endSaturday, June 1, 13
  21. 21. YOUR RUBOTO CLASS FILES Theyre just .rb files Allows you to make changes without a fullrebuild fast feedback Ruboto uses ruby classes that are backed by javaclasses for improved performance. Can still reference Java resourcesexample:R::string::header_textSaturday, June 1, 13
  22. 22. QUICK TOUR OF THE CODE* Time permittingSaturday, June 1, 13
  23. 23. Saturday, June 1, 13
  24. 24. THE RUBOTO COMMUNITY IS GROWINGSome of these projects are still young or have a smalluser base.- They will probably continue to change (improve)- Ruboto is only version 0.12Example:Wasnt able to add a menu to the main activity. InsteadI had to wrap it with the launch activity.The good news is that they could definitely use YOURHELP!Anyone up for trying to make the debugger work?Saturday, June 1, 13
  25. 25. CONCLUSIONRuboto is a great Open Source project with agrowing community that promises to get evenbetter.Yes, it does increase your apps startup timeslightly, but offers a great dynamic nature forrapidly changing apps.Virtually all code can be Ruby, but can alsoreference Java resources if you so desire.Saturday, June 1, 13
  26. 26. RESOURCESSample Codehttps://github.com/joelbyler/Ruboto-MasterMindRubotohttp://ruboto.org/ATDD Training Resourcehttps://leanpub.com/cucumber_and_cheeseMore In-Depth Personal Traininghttp://www.TestAutomationBootCamp.com/Saturday, June 1, 13
  27. 27. DOMO ARIGATO MR. ROBOTO!Fun fact:domo arigato actually means"Thanks a lot!"in Japanesehttp://en.wikipedia.org/wiki/Domo_arigatoSo....Domo Arigato!Saturday, June 1, 13
  28. 28. THAT’S A WRAP!Joel Byler@joelbylerSaturday, June 1, 13
  29. 29. COME FLOAT WITH US!Located on a 10,000 square foot boat on theCleveland waterfront, our team exemplifieshow Agile values & principles are practiced.Come float, deliver, and learn with us, orleverage our expertise to help you changeyour company culture.@leandog www.leandog.comSaturday, June 1, 13

×