Your SlideShare is downloading. ×
0
Introduction to JRubME Roy Ben Hayun Engineering Services CSG                         1
Topics• Requirements for mobile Ruby• Port of the native Ruby VM (MRI)• Porting JRuby to Java ME  > CLDC  > CDC• More thin...
Requirements for mobile Ruby          Sun Confidential: Internal Only   3
Possible usages for mobile Ruby•   Simple application development•   Prototyping•   Development tools•   Education•   Not ...
Requirements from JRubyME• What do we actually want to get?  > The power of Ruby language  > JRubys Java bindings  > An ac...
Port of the native Ruby VM (MRI)            Sun Confidential: Internal Only   6
Porting the native Ruby MRI• See  http://developer.symbian.com/main/tools/opensrc/ruby• Native porting effort is lengthy• ...
Comparing native MRI vs JRuby port• Porting involved:  > Hybrid of C, K&R C, Symbian C++ vs Java only• Porting time:  > We...
Porting JRuby to Java ME        Sun Confidential: Internal Only   9
Choosing the Java ME plaform• CLDC based solution  >   The current Java ME de-facto standard  >   MIDP provides rich mobil...
Choosing the JRuby baseline• Newer versions (v0.9.8 from 2007)  > Closer to the main JRuby branch for easy integration  > ...
Various options for JRuby on Java ME• Newer JRuby mainlines (X axis)   > More language and VM features   > Better Maintain...
JRuby 0.9.8 on CLDC• Initial exploration to get some hands-on feeling• Minor obstacles  >   Missing classes/packages (i.e....
JRuby 0.9.8 on CLDC main obstacles• Obstacles accumulate• Java bindings require reflection capability• Possible solutions:...
Usability obstacle on CLDC• Sandboxing limits the usage of JRuby on mobiles  > Limits usage to MIDP APIs  > Can not jump o...
Summary of obstacles on CLDC• CLDC porting effort becomes a handcrafted port  > Although, it’s not a full rewrite  > But b...
Porting process to CDC• Avoid “We don’t need all that!”• Avoid the big bang blind port• Decremental iterations to downgrad...
Regress on Java SE 1.4• Ensuring it runs on Java SE 1.5 and 1.4• Less libraries to remove then newer JRuby mainlines  > ju...
Regress on Java SE 1.3• Chained exceptions• Few more minor removals  > Missing methods i.e. String.split(), Boolean.valueO...
Regress on Java SE 1.3• Bigger obstacle is that there is no java.util.regex.*• Solution  > Find a replacement package e.g....
Move to CDC• Introspection support incompatible  > java.beans.Introspector required by BeanExtender Ruby    class• Solutio...
Evaluating the CDC port• How does downgrading JRuby to 0.8.2 simplify things?  > i.e. Less than 40 locations of java.util....
Demo on a real device• AWT UI• Can load, modify and launch a script• On device programming                      Sun Confid...
Demo on a real device              Sun Confidential: Internal Only   24
Demo on a real device              Sun Confidential: Internal Only   25
Theres a lot to do from here..           Sun Confidential: Internal Only   26
Bringing JRuby to the mobile space• Co-existence of the native and Java options  > Attracts developers from different back...
Bringing JRuby to the mobile space• JRubME ‘TODO’ list  >   Create a mobile spec (desktop too)  >   Adapt to mobile constr...
Bringing JRuby to the mobile space• JRubME ‘Wish-list’  > Scripting languages gain more traction in the mobile    space  >...
Thank you Roy Ben Hayun Engineering Services CSG                        30
Upcoming SlideShare
Loading in...5
×

Introduction to JRubMe

207

Published on

EXPERIMENTAL: Running JRuby on J2ME: mobile JRuby.

Presentation by Roy Ben Hayun, via:

http://headius.blogspot.com/2007/11/jruby-on-me-devices.html

See more, here: https://github.com/jruby/jruby/wiki/JRubyOnJavaMicroEdition

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
207
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Introduction to JRubMe"

  1. 1. Introduction to JRubME Roy Ben Hayun Engineering Services CSG 1
  2. 2. Topics• Requirements for mobile Ruby• Port of the native Ruby VM (MRI)• Porting JRuby to Java ME > CLDC > CDC• More things to do.. Sun Confidential: Internal Only 2
  3. 3. Requirements for mobile Ruby Sun Confidential: Internal Only 3
  4. 4. Possible usages for mobile Ruby• Simple application development• Prototyping• Development tools• Education• Not Ruby on Rails.• Not much usage today.• Possibly in few years when/if scripting languages gain more traction in mobile space Sun Confidential: Internal Only 4
  5. 5. Requirements from JRubyME• What do we actually want to get? > The power of Ruby language > JRubys Java bindings > An acceptable working subset• What can we keep for later? > Ruby to JVM bytecode compilation > Threading > Any advanced feature Sun Confidential: Internal Only 5
  6. 6. Port of the native Ruby VM (MRI) Sun Confidential: Internal Only 6
  7. 7. Porting the native Ruby MRI• See http://developer.symbian.com/main/tools/opensrc/ruby• Native porting effort is lengthy• Need to port per OS• Requires additional effort for API access > Mobile APIs > GUI• MRI port gives only barebones Ruby language > No mobile APIs Sun Confidential: Internal Only 7
  8. 8. Comparing native MRI vs JRuby port• Porting involved: > Hybrid of C, K&R C, Symbian C++ vs Java only• Porting time: > Weeks vs Days• Value achieved in those ports: > Interpreter – approximately same in both > No OS APIs vs Java APIs via JRuby Java binding > Required customization vs platform independent > JRubME is easier to extend and enhance Sun Confidential: Internal Only 8
  9. 9. Porting JRuby to Java ME Sun Confidential: Internal Only 9
  10. 10. Choosing the Java ME plaform• CLDC based solution > The current Java ME de-facto standard > MIDP provides rich mobile APIs > Requires build-time modifications to replace reflection > Requires source modifications to JRuby• CDC based solution > e.g., Sony Ericsson P990, M600 > Closer to a desktop Java environment > Requires source modifications to JRuby Sun Confidential: Internal Only 10
  11. 11. Choosing the JRuby baseline• Newer versions (v0.9.8 from 2007) > Closer to the main JRuby branch for easy integration > Has more advanced features• Taking an older version (v0.8.2 from 2006) > Has less advanced features > Minimize the porting effort to get a working subset – Less code, fewer dependencies, fewer libraries > Provides the interpreter and Java bindings – Which is what we need for now Sun Confidential: Internal Only 11
  12. 12. Various options for JRuby on Java ME• Newer JRuby mainlines (X axis) > More language and VM features > Better Maintainability• Java platform power (Y axis) > Less porting effort > More usability features Effort / JRuby 0.8.2 / JRuby 0.9.8 CDC CDC Maintainability Java platform closer to desktop Usability / JRuby 0.8.2 / JRuby 0.9.8 trade-off line CLDC CLDC Newer JRuby mainlines Sun Confidential: Internal Only 12
  13. 13. JRuby 0.9.8 on CLDC• Initial exploration to get some hands-on feeling• Minor obstacles > Missing classes/packages (i.e. collections, nio, regex) > Missing methods in existing classes > Migrating to GCF > Obstacles accumulate / JRuby 0.9.8 CLDC Sun Confidential: Internal Only 13
  14. 14. JRuby 0.9.8 on CLDC main obstacles• Obstacles accumulate• Java bindings require reflection capability• Possible solutions: > Pseudo reflection mechanism > Hard wired code support for specific classes – LCDUI, PIM, connectivity, persistance etc. > Same process as using the C API for the native Ruby VM Sun Confidential: Internal Only 14
  15. 15. Usability obstacle on CLDC• Sandboxing limits the usage of JRuby on mobiles > Limits usage to MIDP APIs > Can not jump out of the sandbox > Limits options of development tools – i.e. Limits dynamic extensions of testing frameworks Sun Confidential: Internal Only 15
  16. 16. Summary of obstacles on CLDC• CLDC porting effort becomes a handcrafted port > Although, it’s not a full rewrite > But big enough to diverge from the mainline JRuby• Need to have a CLDC version.• A more powerful JRuby on CDC should come first > Provide a proof of concept > Prototype for mobile usage > Attract developers Sun Confidential: Internal Only 16
  17. 17. Porting process to CDC• Avoid “We don’t need all that!”• Avoid the big bang blind port• Decremental iterations to downgrade JRuby mainline and platform > Ensure it is running on Java SE 1.X > Regress down to Java SE 1.X-1• Move to CDC > And tell the world! / JRuby 0.8.2 / JRuby 0.9.8 CDC CDC• Incremental iterative steps > Integrate with newer JRuby mainlines / JRuby 0.8.2 / JRuby 0.9.8 > Migrate to CLDC CLDC CLDC Sun Confidential: Internal Only 17
  18. 18. Regress on Java SE 1.4• Ensuring it runs on Java SE 1.5 and 1.4• Less libraries to remove then newer JRuby mainlines > junit.jar > bsf.jar and javasupport.bsf.* > ant.jar and the AST serialization• Remove asserts• No java.nio.*• (No autoboxing in the source..) Sun Confidential: Internal Only 18
  19. 19. Regress on Java SE 1.3• Chained exceptions• Few more minor removals > Missing methods i.e. String.split(), Boolean.valueOf() > Missing classes i.e. StackTraceElement > Restricted access i.e. java.util.Calendar.setTimeInMills() Sun Confidential: Internal Only 19
  20. 20. Regress on Java SE 1.3• Bigger obstacle is that there is no java.util.regex.*• Solution > Find a replacement package e.g.,Java 1.4 > Paste into a new package jrubyme.poc.[package] > Modifications as required to package and client code – e.g., sun.text.Normalizer silently commented out.• And do the same for other dependencies Sun Confidential: Internal Only 20
  21. 21. Move to CDC• Introspection support incompatible > java.beans.Introspector required by BeanExtender Ruby class• Solution: > Disable the Ruby beans extension > Serialize Abstract Syntax Tree and redeploy *.ast.ser files Sun Confidential: Internal Only 21
  22. 22. Evaluating the CDC port• How does downgrading JRuby to 0.8.2 simplify things? > i.e. Less than 40 locations of java.util.Regex package usage > Less code e.g., 318 source files compared to 574 in 0.9.8• How does porting to CDC via Java SE simplify things? > Moving closer to CDC gradually > Much fewer new APIs or API differences – No need for handcrafted porting• Remember: we’re trying to get to a working subset Sun Confidential: Internal Only 22
  23. 23. Demo on a real device• AWT UI• Can load, modify and launch a script• On device programming Sun Confidential: Internal Only 23
  24. 24. Demo on a real device Sun Confidential: Internal Only 24
  25. 25. Demo on a real device Sun Confidential: Internal Only 25
  26. 26. Theres a lot to do from here.. Sun Confidential: Internal Only 26
  27. 27. Bringing JRuby to the mobile space• Co-existence of the native and Java options > Attracts developers from different backgrounds > No reason to limit the hosting platform options• Anatomy of free open source success > Governance and decision making capability > Tools for collaboration > Strong community values and commitment Sun Confidential: Internal Only 27
  28. 28. Bringing JRuby to the mobile space• JRubME ‘TODO’ list > Create a mobile spec (desktop too) > Adapt to mobile constraints (ROM, performance, ..) > Rectify the initial porting > Move upwards in the JRuby versions > Migrate to CLDC as well Sun Confidential: Internal Only 28
  29. 29. Bringing JRuby to the mobile space• JRubME ‘Wish-list’ > Scripting languages gain more traction in the mobile space > CDC (or embedded Java SE flavour) to become the mobile Java de-facto standard > Dual compilation and JSR-292 (invokedynamic) – Moore’s law will take care of speed Sun Confidential: Internal Only 29
  30. 30. Thank you Roy Ben Hayun Engineering Services CSG 30
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×