OpenBaseMovil
Welcome at » 2007 » November

We have just released openbasemovil-script-0.1, this is the first revision that we have uploaded. There is still work to do, but the system is running fine and you can create your scripts and extend the script language (please, send your contributions to the project).

We have called the language bmScript, it is an object oriented scripting language, with a syntax very similar to Java, C++ or C#, but a lot easier.

While it is easy, we have designed it to be easily extensible, both the core language it self and the virtual machine interface to “the outer world”. That means that new keywords can be added very easily, and (that will be far more common) you can extend the reach of the language to whatever you want just by providing the appropriate proxy classes.

Lets see the famous Hello World! example with bmScript:

class HelloWorld
{
    method void main()
    {
        system.println( "Hello World!" );
    }

}

Unlike Java, bmScript supports multiple inheritance and has no notion of interfaces. You can extend a class from one or more super-classes, and in case of method conflict the one that belongs to the first declared super-class is used.

Like Java, each class must go in it’s own file with the same name and it is case-sensitive.

class foo
{
    method String sayHello()
    {
        return "hello ";
    }
}
class bar
{
    method int calc( int i1, int i2 )
    {
        return ( i1 + i2 );
    }
}
class foobar : foo, bar
{
    method void main()
    {
        // Will show: hello 25
        system.println( (sayHello() + calc( 10, 15 )) );
    }
}

The next article will be a more in depth look to the language and how can you extend it, with samples from the upcoming releases of OpenBaseMovil-db and OpenBaseMovil-ui libraries that allow the script to access the database engine and the ui toolkit, respectively.

Please, leave your comments. We have big plans for this engine (and the rest of the OpenBaseMovil project), such as running in other platforms like Android, Windows Mobile, Black Berry and Symbian (it actually works through the jvm, but we mean directly for better control and speed).

BlogLines del.icio.us Digg Facebook Google Google Reader Yahoo! MyWeb Newsgator Newsvine reddit SlashDot StumbleUpon Technorati

OpenBaseMovil is a free, Open Source platform for developing powerful J2ME business and consumer applications.

OpenBaseMovil is comprised of several libraries.

What is included in OpenBaseMovil:

OpenBaseMovil-core
This library is the first one we have released, as all the rest depend on it. It contains many services: internationalization, task control, serialization, encryption, compression, floating point support, properties files support, an MVC framework, an event framework, files over RecordStores, and more.
OpenBaseMovil-db
This is a database engine that supports hundreds of tables, with even hundreds of thousands of rows per table. It is a relational database engine, with tables, which in turn have fields. This is not an object persistence framework as some that are around there, you don’t have to care about serialization and deserialization of objects, you have a database like MySQL or any other RDBMS. Tables can have multiple indexes on one or more fields, even full-text-like indexes, so finding data is a really simple task. By now, it is not a SQL database nor an ACID system, we might implement that kind of things in the future. But you must not loose focus, we are talking about a cellular phone like a Nokia N70 or a SonyEricsson K610 dealing with many thousands of rows with search times of around 50-100ms for direct search indexes and abut 300-400ms for full-text searches. Phones are more powerful each day, but you can not ask them things like parsing complex SQL queries.
The database engine provides a simple API, very similar to that of JDBC, so you can manage your data easily. There are four main objects that you will deal with: Database, Table, Row and RowSet. You use the Database to hold Tables, and the Tables to create and handle Rows and also to search them. RowSet is, as you have already guessed, a set of Rows for a given search over a Table, and you use it almost as you would use a JDBC ResultSet.
OpenBaseMovil-script
This is one of our latest creations, a scripting engine for JavaME (J2ME). We still consider it release candidate version, but it is very functional and powerful now. Many of our future plans have this engine as their basis, so we have built it with some clear goals:

  • It must be easy to code
  • The language must be very easily extended
  • It must have a core library of tools that must be also easily extensible, so the scripts can interact with any current or future element.
  • It must be very fast

We have called the language simply “bmScript”. It is an object oriented language, with a syntax close to the C family (Java, C#, C++, etc.) but easier. It is compiled to a binary, optimized format, and that can be done at the mobile phone or you can compile the scripts and then send them to the device.
The core library has just some tools by now to be able to create maps (like arrays) and to interact with the basic system utilities (the console and so on). But, the database engine has some classes that when plugged into the engine let you access the database, just like you could do with Java. The same applies to the ui libraries.
This is the next library that we will upload to SourceForge, along with the proper documentation and examples.

OpenBaseMovil-storage
The storage library is a pluggable library used by the database. It acts as a proxy to the underlying storage mechanism, currently the only one available: RecordStores. It also provides useful services on top of that to improve performance and ease of use.
Some devices do not impose limits on RecordStore sizes, some others do. Most of them have bugs, some very important, others not so. This pluggable library is designed to overcome that kind of things, releasing the database engine of that burden.
OpenBaseMovil-ui
After years of dealing with the user interface, we’ve come to some important conclusions:

  1. The MIDP interface has some advantages, but also many shortcomings, many bugs and many differences between devices. It’s a nightmare to deal with them all. At some points, the specification is too loose, and each manufacturer decides how to do it. And the bugs, the nasty bugs. For example, the latests Nokia phones with Symbian 3rd edition get hanged very often with forms with edit boxes. And they might fix it, but the truth is that they probably won’t. The reason is very simple: J2ME is targeted to games, so their effort in the “text” interface is clearly smaller.
  2. As it comes from the first point, the graphical interface is much more powerful and less error prone.

And since we want a consistent interface through different models, simple to design, database aware, and user friendly we built the ui library.
This library lets you define your application views with a simple xml file, and has a lot of powerful different views: grid menus, list menus, forms and list browsers. For example, with a list browser you just give it a name, the fields you want to be displayed, and then you bind it to a RowSet and it shows the user a graphical list that shows information about the number or rows, the current one, and shows a single line for unselected rows and a extended view of the selected one. It handles all of the database navigation and data fetching for you.
We plan to evolve this library into a window toolkit, so the interface can became fully consistent. One of the drivers is the bug mentioned on the Symbian 3rd platform, but it imposes some challenges: dealing with user input in text fields is not easy and has it’s drawbacks. For now, the forms are built with the standard MIDP forms, but enhanced with data binding and zero-code design.

Helper tools: resource packing and checking, view compiling, and others.
These tools are simple helper tools in the development process. For example, the resource packer takes your resource files (properties files) and checks that all resources are defined in all files (no missing resources in any language). It also packs many bundles (each library has it’s own set) into a single bundle, which is easier to handle from an application.
BlogLines del.icio.us Digg Facebook Google Google Reader Yahoo! MyWeb Newsgator Newsvine reddit SlashDot StumbleUpon Technorati