Script for making Applications Background - The complexity of applications increased extremely. - Applications need to be applied large-scale refactoring. What can the script do ? - Can reduce code-size and increase maintainability. - Make it easy to append new applications. - When the middleware layer is modified, the modification doesn’t propagate to the application layer. It’s limited to the script-engine layer. Candidate script languages - Lua, Python
What’s Lua Lua is Implemented and maintained by Tecgraf*1. Lua has used in many industrial applications such as Adobe’s Photoshop Lightroom. Lua is the leading scripting language in games. Lua is Embedded in games ( e.g. World of Warcraft ) and Ginga*2. : Tecgraf - http://www.tecgraf.puc-rio.br/*1 : Ginga brasil – 브라질향 데이터방송 규격*2
Why Lua Lua is small - The source contains around 17,000 Lines of C. - All standard libraries take just 144K Bytes. Lua is powerful - Lua provides meta-mechanisms for implementing classes and inheritance. - Lua provides garbage collection. Lua is fast - Several benchmarks show Lua as the one of the fastest languages. Lua is portable & embeddable - Lua is definitely easy to be embedded with small footprint. Lua is free : MIT License*1 : MIT License - http://ko.wikipedia.org/wiki/MIT_%EB%9D%BC%EC%9D%B4%EC%84%A0%EC%8A%A4*1
Lua-Application Prototyping - 1/2 We ported mobile Calculator into Lua - We implemented UI Wrapper functions which are required in Calculator. - GTK-related functions and Softkey functions. - Calculator Logic is implemented by Lua script. - Main functions which is needed in 4 fundamental rules of Arithmetic are ported now. - The prototype of Lua-Calculator is successfully ported in our mobile platform.
What’s Python Released first by Guido van Rossum in 1991. Now managed by Python Software Foundation*1 Embedded as a scripting language in these S/W products. *2 - GIMP, gedit, Vim, Maya etc - In mobile domain, Python for s60*3 Features a fully dynamic type, automatic memory management. *1 : Python Software Foundation – Wikipedia, http://en.wikipedia.org/wiki/Python_Software_Foundation *2 : Python-embedded S/W – Wikipedia, http://en.wikipedia.org/wiki/Python_software *3 : Python for s60 – nokia.com http://wiki.opensource.nokia.com/projects/Python_for_S60
Why Python Highly Readable - Python uses whitespace indentation to delimit statement blocks. Powerful Standard Library - Python has a very large standard library. Powerful Glue Language - Python has the ability to use a lower-level language such as C/C++. - Python can easily attach new modules by using ctypes*1 or swig*2, etc. Free - Python Software Foundation License*3 : Allows modifications to the source code and derivative works.*1 : Ctypes – http://www.python.org/doc/2.5/lib/module-ctypes.html*2 : Swig – http://www.swig.org*3 : Python Software Foundation License – http://en.wikipedia.org/wiki/Python_Software_Foundation_License
Python-Application Prototyping : Calculator To wrap gtk layer, we try to use PyGTK*1. platform-dependent functions such as Softkeys are not yet implemented by hand. Calculator UI : 114 Lines of python code - Example UI code : Y:funcalc.py : PyGTK : GTK wrapper for python - http://www.pygtk.org/*1
Lua vs Python Lua PythonBinary size about 200KB About 2MB (Lua version 5.1) (Python version 2.6)Memory usage Lua is more compactSpeed Lua is faster*1Multi-threading Thread-safe Poor-qualityStandard Library Small & compact Rich & powerfulGlue ability Easy Normal*1 : see also Lua vs Python : CPU+Memory
What is the most suitable for mobile applications Lua is more compact and faster than Python. But Python is further powerful. - Python has lots of build-in modules and many open-source wrapper modules such as pyGtk. In case of mobile application which has abundant resources, Python is the most suitable for applications.