|
Newsletters
|
|
|
|
|
The WDN Symbian DevZone... Richard Takes a Closer Look at
CodeWarrior Professional and Outlines The Development Process
by Richard Bloor, July 01, 2002
Last week we took a look at the developments around the CodeWarrior toolset for
the Symbian OS. This week we take a brief tour of the Professional tool by building
one of the example Java applications.
Printer Friendly Version
Last week we outlined the tools available from Metrowerks for developing Java and
C++ applications for the Symbian OS. This week we take a look at CodeWarrior
Professional and outline the development process. If you are unfamiliar with the
process for earlier versions of the Symbian OS you might like to take a look at an
earlier posting on Java Development to appreciate how much more straightforward
it is with CodeWarrior.
CodeWarrior organizes your application code as projects, and so the obvious
starting point for any work is to create a suitable project. Each project is based on a
stationery template and two are available in the Symbian tool, an empty project and
the Symbian Stationery Wizard. The Empty Project is exactly that, one without pre-
configured collections of template source files, library files, or build targets.
Obviously we select the Symbian Stationery, then enter a project name. Selecting
OK proceeds to the wizard prompting for the target SDK.
As UIQ is the only currently available V7 SDK it is the only one listed, obviously all
the available SDKs loaded will be displayed. When we have selected the UIQ SDK
we proceed to selecting the development language we will be using. Here we have a
choice between Java and C++.
I have chosen to go with Java in this case so I select the Stationery and CodeWarrior
creates my project. The project window is now displayed.
The default view in the Project Window shows the list of files included in the project,
generally these will be the files of code written. The second tab “Link Order”
provides information on the Link order to be used when compiling the code and the
final tab “Targets” contains details about the targets that the code will be compiled
for.
Along the top of the Window are a number of icons for commonly used facilities and
actions including target settings, make, debug and run. The Target settings were
created as part of the project creation process from the stationary defaults and SDK
choice.
While an exhaustive review is beyond the scope of this short introduction, the screen
above shows an example of the Target settings and how the Main Class and Virtual
machine are defined. This is telling CodeWarrior that in our sample program the
main Class is HelloWorld and when it is run it does so in the UIQ virtual machine.
We can now run the sample Hello World program, using the run button from the
project window, the code is compiled and the UIQ emulator started. However the
code does not seem to execute as the emulator starts showing the UIQ application
picker screen. This is a “feature” of running any code under a Symbian emulator.
As the emulator takes some time to load the Java application will have started before
the main UIQ screen is painted and is therefore overwritten and not visible. There
are two principal ways to overcome this problem. You could use the debugger to
halt execution at the start of the main method and then restart the program when the
emulator has loaded. Alternatively you could add code to sleep the application and
give time for the emulator to start. We will do the latter and take a look at the editor.
The editor as you can see is able to color keywords within the code and has several
powerful features. These include quick navigation to Interface files and Functions in
the code, the ability to mark and then jump to these marks. It also gives the ability to
access version control commands (when version control software is implemented).
A powerful search and replace feature is also provided with functionality to span
code files and projects.
The editor can also be used to edit plain text files, release notes or readme files for
example.
There is also a compare tool that visually indicates the differences between code
files, which in the following example shows the original HelloWorld code compared
to the code with the sleep lines added.
To make use of the sleep code we need to add a command line argument for the
application to detect that we want it to sleep. The sleep is done this way so when we
run on a device, where the loading problem does not happen, we can skip the sleep.
(Obviously in the final version of the code we can remove these lines.) We add the
argument through the Target settings as shown in the following screen.
So now we can run the code and see the application in the UIQ emulator.
Obviously our simple code example does not need debugging however before we
finish it is probably worth just showing you an example of the debug window as this
will be a feature used well by most developers.
The debugger window shows three panes:
- Top left is the Stack pane which displays the current subroutine calling chain,
with the current routine at the bottom of the list
- Top Right shows the programs variables with options to display all, only those
relevant to the current statement and none, which would be used to improve
stepping performance where remote debugging was being undertaken on a slow
link (which will be applicable in V2 of the tool for Symbian when remote
debugging is fully integrated)
- Bottom the Source Code pane, which display the code around the current line to
be executed.
Each pane can be expanded to use the full debug window that allows easy reviewing
say when the number of current variable gets large.
All the usual debug actions are available, stepping line to line, stepping over or out
of subroutines, marking break points. The Breakpoint control is comprehensive with
the ability to defined them as temporary, only stopping the code execution once,
conditional so the code only stops if a variable contains a certain value and rich
breakpoints, where plus-ins can be activated, for example a code profiler. Other
features include the ability to view Symbolics, expressions and edit variable values
while debugging.
There are a significant number of features we have not touched on in this whistle
stop tour. For me some of the keys additional features include:
- dead code stripping and optimization
- integrated JavaCheck technology
- a powerful Object browser and
- on-device debugging (although this is done through a command line tool in the
current version).
Finally it is also worth noting that the process for creating a Java application in
CodeWarrior Professional for Symbian that we have followed is very similar, if not
identical to the way CodeWarrior would be used to write, debug and run virtually
any piece of code.
Development for the Symbian OS has always been a clumsy process as there was no
integration between IDEs and the Symbian tools. CodeWarrior has overcome that
problem with a integrated environment which allows the developer to concentrate
on developing rather than having to navigate through a convoluted set of tasks to
take code from development through the emulator and onto a device. The future
development of CodeWarrior will improve the process further with integration of
various deployment tools.
The Metrowerks CodeWarrior Professional for the Symbian OS is currently available
with a Beta version of the UIQ SDK for the SonyEricsson P800 through Ericsson
Mobility World. Two versions of CodeWarrior Wireless Studio are available
exclusively for Java development for the 9210 and more information is available on
Metrowerks web site.
About the "WDN Symbian Guy" Richard Bloor:
Richard Bloor has 16 years experience in the IT industry. His earlier
work was largely in design and development of commercial and
manufacturing systems but more recently has focused on
development and test management of government systems.
Richard Bloor is the Mobile Applications champion at System
Architecture consultancy Equinox of Wellington, New Zealand.
Richard can be reached at rbloor@wirelessdevnet.com.
Symbian DevZone Home
|
|
|