Your SlideShare is downloading. ×
Rapid and Expressive Prototyping on Cell Phones via Script ...
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Rapid and Expressive Prototyping on Cell Phones via Script ...

466
views

Published on


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
466
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Rapid and Expressive Prototyping on Cell Phones via Script Embedding Jingtao Wang Computer Science Division [email_address]
  • 2. Agenda
    • Motivation
    • Challenges in creating cell phone app
    • Overview of popular mobile development platforms
    • Low threshold and high ceiling, the script embedding approach
    • Summary
  • 3. The Popularization of Cell Phones
  • 4. Cell Phone is THE Portable Computing Device
    • Global penetration reached 50% (3.3 Billion) on 11/29/2007
    • 59 countries had cell phone market share over 100%
      • Luxembourg 158%
      • Hong Kong 140%
      • Italy 122%
      • United States 81%
      • China ~ 42%
      • India 23% (largest growth market)
    • There are only around 850 million PCs in the world.
    * Data from Informa Telecoms & Media
  • 5. Opportunities and Challenges of Cell Phones
    • The bright side
      • Portable, always with you
      • Always on, always connected to the internet
      • Seamless integration with one’s social networks
      • High market penetration throughout the world
    • The dark side
      • Limited resources (CPU, memory, screen, input modality)
      • Highly diversified hardware and software implementations
      • Incomplete development tools and libraries
      • Proprietary hardware/software decrease competition and add costs in development and distribution
  • 6. Threshold and Ceiling Sophistication (Ceiling) C/C++ Goal HTML Difficulty (Threshold) MFC/Qt Flash ActionScript Component Framework
  • 7. An Overview of Mobile Development Platforms - 1
    • Mainstream (non-smart) Phones (more than 90% market share)
      • J2ME (Java 2 Micro Edition)
      • BREW (Binary Runtime Environment for Wireless)
      • Flash Lite
      • HTML, WAP/WML
  • 8. An Overview of Mobile Development Platforms - 2
    • Smart Phones (less than 10% market share)
      • Windows Mobile ( Embedded Visual C++ , .Net Framework Compact Edition)
      • Linux (C/C++, Java, J2ME)
      • Symbian ( C++ , Python)
      • Palm ( C/C++ , J2ME)
      • Flash Lite
      • BREW
      • HTML/AJAX, WAP/WML
  • 9. J2ME
    • Best availability on different platforms
    • Can leverage knowledge and resources from desktop Java
    • Good debugging support
    • Poor UI framework/libraries
    • Inconsistent behaviors in different devices (write once, debug everywhere)
    • Poor performance (no JIT on most devices)
    • Low ceiling (can only do what the built-in libraries allow one to do)
    • Signature required to access certain functions
  • 10. BREW
    • Using C/C++ as the host language
    • Excellent performance (applications run as compiled native code)
    • Small target application size and little overhead
    • High ceiling (can access all the capabilities of the phone)
    • The only widely available native API for non-smart phones
    • Steep learning curve
    • Bad UI library
    • More costs for the development environments and the development process
    • Hard to debug (different behaviors between the simulator and the real device)
    • Troublesome coding restrictions
    • Signature required to run any applications on a cell phone
  • 11. Flash Lite
    • Flash Lite 2.x similar to Flash 7.0
    • Excellent IDE/Emulator support
    • Powerful functions for animation/vector graphics
    • Low learning threshold
    • Low runtime performance
    • Hard to access functions not provided, low ceiling
    • “ ActionScript Stuck”
  • 12. HTML, WAP/WML
    • Available on almost all cell phones
    • Low learning threshold
    • Easy to debug (functions implemented on the server side)
    • Low ceiling
    • Limited interactivity function support
    • Almost impossible to access local resources of the cell phone
    • High latency, requires network connection
  • 13. Windows Mobile – Embedded Visual C++
    • Excellent performance
    • Intermediate learning curve for existing C/C++ programmers
    • Relatively steep learning curve for non-C/C++ programmers
    • Easy to access hardware features
    • Excellent UI framework and UI builder
    • Excellent IDE/debugger support
    • Excellent emulator support
    • Limited device penetration
  • 14. Windows Mobile – .Net Framework Compact Edition
    • Medium to Good performance
    • Low learning threshold
    • Excellent UI framework and UI builder
    • Excellent IDE/debugger support
    • Excellent emulator support
    • Extra space overhead (2 mb)
    • Limited device penetration
  • 15. Symbian – C++
    • Excellent performance
    • High learning threshold
    • Reasonable UI framework
    • High ceiling
    • High market share among smart phones
    • Poor IDE/debugger support
    • Troublesome coding restrictions
    • Poor simulator support
    • Limited device penetration in the U.S.
  • 16. Symbian – Python
    • Poor performance
    • Low learning threshold
    • Reasonable UI framework
    • Relatively high ceiling
    • Poor IDE/debugger support
    • Poor simulator support
    • Additional runtime overhead (> 1mb)
    • Limited device penetration in the U.S.
  • 17. Palm
    • Huge paradigm shift between version 1.x – 4.x and 5.x +
    • Only device specific simulator after 5.x
    • Gradually becoming obsolete
  • 18. Android and iPhone
    • Android
      • Customized version of Java (between Java desktop and J2ME)
      • Good UI framework (when compared with J2ME)
      • Limited media capture capability as J2ME
      • Calling native functions is discouraged
    • iPhone
      • HTML + AJAX based web app running on browsers
      • Native app (Objective C)
  • 19. Native Code vs. Dynamic Script
    • Native Code
      • Excellent runtime speed
      • High threshold, high ceiling
      • Easy to access the low level hardware
      • Difficult to program and difficult to debug
    • Dynamic (Interpreted) Script
      • Slow runtime speed
      • Easy to learn, low ceiling
      • Easy to debug, easy to share
      • Hard to access extra features of the hardware
    • Can we take advantages of nice things from both approaches?
  • 20. Embedding Scripts to the Host Application Host Program Embedded Interpreter color = RED b = button { label = ‘OK’, x = 10, y = 20} Wrapped Library
  • 21. Choice of the Embedded Script Engine
    • Lua is a powerful, fast, light-weight, embeddable scripting language
      • Originated in 1993, now developed by Lablua
      • Designed as a lightweight embedded script language
      • A leading scripting language in the games industry
      • See www.lua.org
    • Has been ported to BREW, Windows Mobile and Symbian
  • 22. Approximate Runtime Performance
    • Not intended to be a comprehensive evaluation
    • Benchmarking programs (sorting, factorial computing, string operations)
    Vs. Runtime Speed Runtime Memory C/C++ 1/5 ~ 1/12 1.0 ~ 1.5 Python 1.9 ~ 3.5 2.1 ~ 3.3 JavaScript 2.3 ~ 18 1.7 ~ 9.7
  • 23. Some Sample Codes function HelloWorld () io.write (&quot;hello World&quot;) trace (&quot;trace working now&quot;) end HelloWorld() function fat (n) if n == 0 then return 1 else return n*fat(n-1) end end Function max(a, b) local m = a if b > a then m = b end return m end 1 MOVE 2 0 0 ; R(2) = R(0) 2 LT 0 0 1 ; R(0) < R(1) 3 JMP 1 ; to 5 (4+1) 4 MOVE 2 1 0 ; R(2) = R(1) 5 RETURN 2 2 0 ; return R(2) 6 RETURN 0 1 0 ; return
  • 24. Easy to Switch Between both Worlds LIBSHELL_API int LibSHELL_MessageBoxText(lua_State *L) { const char *szTitle = (const char *)luaL_checkudata(L, 1, AECHAR_TNAME); const char *szText = ( const char *)luaL_checkudata(L, 2, AECHAR_TNAME); ISHELL_MessageBoxText(GETAPPSHELL(), szTitle, szText); return 0; } …… lua_register(L, “messageBox&quot;, LibSHELL_MessageBoxText ); Exporting the ISHELL_MessageBoxText function from BREW to the script Void FireEvent(int id, const char * args) { if (g_strEventHandler != NULL) { char buf[254]; SPRINTF( buf, “%s(%d,%s)”, g_strEventHandler, id, args); lua_pcall(luaState, buf, LUA_MULTRET, 0); } return; } Calling a lua function (event handler) from C/C++
  • 25. Scaffolding Mobile Development via Script Embedding
    • Average users
      • Use form-guided code generation templates to customize an application
      • Download and share new functions
    • Group development
      • Only one member responsible for C/C++ programming, expose additional native functions to script programmers via glue function
      • Other members fast prototyping in script
    • Runtime performance sensitive application
      • Identify performance bottlenecks in the script implementation, reemployment them in C/C++ and export them to the script
  • 26. Summary
    • Building applications for cell phones is challenging due to highly diversified environment and toolkits
    • Trade-offs between low learning threshold and high ceiling need to be carefully considered
    • Script embedding is a solution to leverage nice features from both worlds
  • 27. Thanks!
    • Any questions?

×