Home Page   We Generate Your Software.
Products Services Company Technology Demo Contact Site Map Search

Full list of in-depth articles - Feedback and questions - Request demo -

Gen-build-run Series 60 form apps with SoProMach

  1  The sample "form" application
  2  Generating a simplified AknExForm
  3  Gen-build-run
  4  More form applications
  5  Adding application logic
  6  Machine-made source code
  6.1  Simplified AknExForm
  6.2  Two-form
  6.3  Three-form
  Appendix A  Statistics
  Appendix B  Sample SoProMach/S60FormGen software molds

The home page of www.series60.com reads: "The Series 60 Platform, built on the Symbian OS, is currently the leading smartphone platform in the world." Many readers that remember the first IBM PC with a color monitor and MS-DOS probably get dizzy when reading the feature list of any smartphone based on Series 60. And many developers who wrote C code for that IBM PC get dizzy as well after realizing how complex an apparently simple Series 60 application in C++ can be. This article describes how custom-made generators can help Series 60 developers write applications more rapidly with less tedious work.

1 - The sample "form" application

The reference development environment for this article is the Series 60 2nd Edition SDK for Symbian OS, Supporting Feature Pack 2, For C++, Supporting Metrowerks CodeWarrior. This SDK is available after registration on www.forum.nokia.com. It contains several example applications, one of which is the Form Example used for the sample custom-made generator described in this article.

The Form example application, also referred to as AknExForm, demonstrates how to use the forms and editor controls available on the Series 60 Developer Platform. The class diagram of this application is shown in the figure below, taken from the SDK documentation.

Figure 1 - AknExForm class diagram

Figure 1 - AknExForm class diagram

In a way, the above class diagram defines a class, or macroclass, of form applications. The custom-made generator here described (hereinafter referred to as SoProMach/S60FormGen) produces complete applications belonging to this macroclass.

2 - Generating a simplified AknExForm

The original AknExForm contains all the know-how necessary to build different types of forms, such as single-page vs. multi-page, or view-or-edit vs. always-edit. The sample custom-made SoProMach/S60FormGen produces one-form or multi-form, single-page, view-or-edit form applications. The first sample application generated with SoProMach/S60FormGen is the one-form application shown in the following screenshots of the Series 60 emulator running the application. This generated application is a subset of AknExForm.

Figure 2 - The smartphone menu

Figure 2 - The smartphone menu

Figure 3 - Menu
of simplified AknExForm

Figure 3 - Menu<br>of simplified AknExForm

Figure 4 - Form
in view mode

Figure 4 - Form<br>in view mode

Figure 5 - Form
in edit mode

Figure 5 - Form<br>in edit mode

Figure 2 shows the icon of the generated application. Figure 3 shows the available options (All editors, Exit) for the "Edit" application. Figures 4 and 5 show the form in view and edit mode respectively. Data input is checked on entry by means of appropriate editors, according to the type of data being input (plain string, numeric range, date, time, duration, secret code).

3 - Gen-build-run

How can a developer produce the application above with SoProMach/S60FormGen? How can the application form, or forms, be designed and described?

SoProMach is a purely textual software production machine, and so are the custom generators built on top of it. Therefore to "configure" the generation job, the developer writes one or more textual files. Several formats are accepted by SoProMach: Somusar/EF (see below), XML, CSV, or ad-hoc domain-specific languages (DSL).

For this specific SoProMach/S60FormGen generator, the sole input required is an EF (entity file) description as the one shown below. (Note by the way that SoProMach-based generators can be integrated with any IDE providing support for external tool invocation: see examples of integration with Eclipse and with Visual Basic Express 2005 Beta).

Figure 6 - Input to the generator: "akn_ex_form.ef"

Figure 6 - Input to the generator: "akn_ex_form.ef"

Readers unfamiliar with EF files may view different examples in different contexts, such as the entity files of the Eclipse-driven Java/JSP/DAO Struts generator.

The simplified AknExForm application described in the previous paragraph is generated and built in a completely automatic fashion starting from "akn_ex_form.ef": no hand-edits whatsoever are required to build it. In fact, SoProMach/S60FormGen itself runs the commands of the build environment, as shown in the next picture.

Figure 7 - Generating and building

Figure 7 - Generating and building

The careful reader might have noticed that generating and building the application required about twelve seconds, including compiling, linking and deploying the application, which is then ready to be run in the emulator.

4 - More form applications

Now that the software production mechanism is in place, it is easy to create new applications by simply creating new EF files, as the ones shown below.

Figure 8 - Two-form
application description

Figure 8 - Two-form<br>application description

Figure 9 - Three-form
application description

Figure 9 - Three-form<br>application description

When the EF files are ready, re-running SoProMach/S60FormGen results in two new applications. The 3-form application is shown in the screenshots below.

Figure 10 - More apps
in the smartphone menu

Figure 10 - More apps<br>in the smartphone menu

Figure 11 - Menu
of the 3-form application

Figure 11 - Menu<br>of the 3-form application

Note the cascading "Biz" menu, as configured in "three_forms.ef" by means of parameter UI.biz.cascade_menu set to "true". The next figures show the Biz form in edit and view mode, and the Friend form in view mode.

Figure 12 - Biz in edit mode

Figure 12 - Biz in edit mode

Figure 13 - Biz in view mode

Figure 13 - Biz in view mode

Figure 14 - Friend in view mode

Figure 14 - Friend in view mode

5 - Adding application logic

When the forms of the applications are ready, the developer can extend the generated application as desired. Several options would be available that go beyond the scope of this article. Here we will mention only that both IDE-oriented and text-editor developers will be able to extend the application in their preferred way. In particular, users of Metrowerks CodeWarrior can import the project directly into the IDE, as the following picture shows.

Figure 15 - Importing the generated project into CodeWarrior

Figure 15 - Importing the generated project into CodeWarrior

Afterwards it is of course possible to edit, build, and run the application within the IDE, as shown below.

Figure 16 - Editing the generated application

Figure 16 - Editing the generated application

6 - Machine-made source code

The links to the code files generated by SoProMach/S60FormGen for the three applications are listed below. The code looks very similar to the code of the original AknExForm example application.

6.1 - Simplified AknExForm


6.2 - Two-form


6.3 - Three-form


Appendix A - Statistics

A measure of the efficiency of SoProMach/S60FormGen can be given by the output-to-input ratio: the higher the number, the more efficient is the generator. Under this respect, the measure in terms of files is given by the number of generated files divided by the number of input files, which is

    20 / 1 = 20

Alternatively, this measure can be calculated in terms of lines of code (LOCs). The overall number of LOCs for the three applications yields

    6653 / 133 = 50.02

Appendix B - Sample SoProMach/S60FormGen software molds

SoProMach-based generators utilizing EF files produce software by means of so-called Software Molds. Molds can range in complexity from very simple to very complex. SoProMach/S60FormGen provides some good examples of software molds.

The mold for generating the <<AppName>>Document.cpp files of the applications is very simple. In fact, it is just a one-file template (code/moldkit/UI/mold18-Document.cpp/file.hdr)

The structure of the <<AppName>>SaveForm.cpp files is more complex, and the corresponding mold reflects this complexity. Note that the mold's complexity is roughly equivalent to the internal complexity of a compiler, the major difference being that SoProMach allows to build "open" compilers, in that they are made up of text files that might be adapted and extended as required.

A first block of <<AppName>>SaveForm.cpp code is produced with a file.hdr introduction. Then, two molding steps are required, described below. Finally, a trailing block is produced with file.trl.

The intermediate steps produce leading and trailing blocks of code for each step and for each form defined in the input EF file, generating additional code for each member of the form.

The details for step #1 are as follows:

Step #2 is performed in a similar way:

Written on 3 March 2005 - Updated on 23 March 2005
Full list of in-depth articles - Feedback and questions - Request demo -

http:// www.somusar.com  / company  / news  / in_depth  / s60_forms  - Powered by SoProMach
Copyright © 2003-2012 Somusar - Trademarks - Legal - Privacy - Webmaster