Developers/Stack

From OLPC
< Developers
Revision as of 20:15, 14 December 2007 by Mcfletch (talk | contribs) (Begin writing real introductions.)
Jump to navigation Jump to search

Previous Next

There are a number of approaches (software stacks) to develop software for the OLPC environment. The stack you choose will strongly influence what type of setup you need and what your actual development process will look like.

This section attempts to describe the major Activity development stacks available in the OLPC Sugar environment.

EToys

EToys is a Smalltalk development environment running on the Squeak virtual machine. Smalltalk is an "old" teaching language, that is, it has been in use for decades, and as a result has a huge body of components and pre-built content and resources that can be used to create new activities.

The EToys environment is easily scripted via GUI interactions, and components have access to the all of the special hardware features on the laptop. You can often create fascinating projects and useful demonstrations with just a few mouse clicks and bit of simple logic.

Browser

Sugar includes a Mozilla-Firefox-derived (Gecko) Web Browser Activity. This browser includes HTML, XHTML, Javascript and SVG support. You can set up simple web-servers on a laptop using Python, or children may access an application hosted on a public web server (but keep in mind that children often have very poor connectivity).

You can develop for this platform with no particular hardware or setup, and can test using regular Firefox during initial stages. It is easy to port work from elsewhere into this stack, and easy to export your work for use outside of the OLPC project. The environment is, however, rather constrained, without access to most of the special hardware or software components on the laptop.

Browser Component

The built-in Browser is actually just a thin wrapper around the Gecko control. You can use the Gecko control yourself and create web-browser derived activities, either using XUL or Python/PyGTK to instantiate the browser. This gives your Activity access to system services and hardware, at the cost of considerably more complexity.

PyGTK

Python and GTK based activities are the "standard" way to write software for the OLPC. The support for writing activities provided by the core Sugar system (which is itself largely written in Python) is almost always exposed first through Python libraries.

On the Sugar platform, PyGTK has access to the following major support libraries:

  • Cairo -- high performance postscript-like library for drawing vector graphics, with the RSVG SVG-rendering library
  • Pango -- flexible text layout system capable of dealing with complex internationalization issues
  • DBUS -- inter-process communications
  • Telepathy -- inter-machine communications and presence management
  • Web Browser Control -- Gecko 1.9 web browser as a simple embeddable control with Python DOM access
  • AbiWord/AbiCollab Control -- AbiWord word processor as an embeddable control with the ability to collaboratively edit with another user
  • NumPy -- high performance numeric analysis and array-handling

in addition to the Python standard library.

OLPCGames

Flash

Official description of the Software components on the laptop (XXX maybe merge this into that page, we want links to further information about each library, though?)

Development Languages:

  • Python is strongly encouraged, to have a single language "under the hood" when the curious child looks inside
    • C/C++ should be used where Python performance is unacceptable, but try to keep it to a minimum, preferably as standard well-encapsulated and documented components
  • Smalltalk-speaking developers may wish to work within the eToys environment
  • Javascript can be used in web-based applications (Gecko or Opera engine Javascript implementation)

GUI Environments:

  • PyGTK or the PyGTK-derived Sugar system should be used for most "Window, Icon, Mouse, Pointer" type GUIs. Note, however, as of 2007-04-21 that the Sugar "graphics" package is in Flux.
  • Pygame SDL-based 2D game environment can be used for "Canvas" graphics using "Sprites".
  • (Mozilla) XULRunner can be used to develop Gecko-based activities
  • EToys

Operating Stack:

Libraries/modules/services of note:

  • D-BUS -- efficient Desktop-level RPC engine, most specialized laptop hardware and operations are exposed over DBus
  • Telepathy (Glib, Salut, Gabble) -- collaboration/communications engine with "Tubes" (cross-machine RPC over DBus) and various network traversal and discovery logic, activities are encouraged to use Tubes where ever practical
  • CSound -- acoustically modelled sound-synthesis engine (seen in the TamTam activity)
  • Abiword -- collaborative text editor/word processor usable as a GTK widget that can be embedded in other activities
  • SQLite -- lightweight relational database
  • XULRunner (with Python DOM-capable bindings) -- Gecko 1.9 (Firefox 3.x) engine
  • GStreamer -- general purpose media streaming platform, used for accessing the video camera and playing media
  • Avahi -- discovery and advertising mechanism for mesh-hosted services

Common libraries not available:

  • OpenGL
  • Server-based relational databases (MySQL, PostgreSQL)
  • If you are unsure whether something is supported, ask, or load up an emulated machine and check for the presence of the library

Testing/working:

  • Announce your project on the OLPC devel list so that people know what you are working on and duplication of effort is reduced
  • Add your project to the Software projects page
  • Test your application in an official image (or a physical laptop) before publishing broadly
  • To conserve memory or improve performance, consider replacing problematic areas in your Python code with C. For example, a rewrite of the hardware manager service in C saved 1.8 megabytes of private dirty memory. On a machine with only 256 megabytes of RAM and no swap space, efficient use of memory can make the difference between a usable system and a system made unreliable by out-of-memory failures.
  • Distribute your source code under the GPL, LGPL or MIT license.
  • When ready to test with real users add your activity to the Activities page to allow for easy download and installation

Previous Up Next