Tuesday, 22 April 2008

Mobile development with .NET CF

It's been a few days since the last posting, I've been meaning to jot down some notes from the workshop at Microsoft (Reading Uk, 16-April-2008) before anything gets forgotten:

The aim of the workshop was to discuss the use of the Microsoft .Net Compact framework for mobile application development - including performance issues and technology features. This was in the context of both our existing Java mobile applications and choosing suitable technologies for new projects.

Java ME J9 6.1.1 performance evaluation:

To illustrate the performance we'd experienced with out Java ME applications, we demoed our existing Java ME application running on IBM J9 CDC ppro1.1 on an IPAQ. The response was actually very positive. It was suggested that re-implementing it in .Net would not yield any worth while performance gains but it would most likely create a different set of problems to solve.

We ran our app with JIT enabled, noverify and nolinenumbers but it was not compiled as a JXE on this occasion. Focus was on running application performance as perceived through the GUI (user perceptions), we did not delve into profiling information. We did not look into start up times, which are roughly similar for both Java and .Net VM based technologies.

.Net CF:

.Net CF does provide some benefits, in terms of integration with the Windows operating system (integration with the Windows menu bars etc) that would be worth bearing in mind for future projects. Specifically, notification of docking events could prove very useful in some situations. Native code is supported, as external libraries (not within the assembly) but hooks into the OS API are possible by declaring them within the .Net assembly.

Versions / dependencies:

For .Net development some care regarding versions and dependencies should be considered, for example whilst versions of Windows Mobile from 5.0 onwards _should_ support any version of .Net CF, the same can not be guaranteed for the more variable CE, where platform vendors could load a CE image missing key components required for installing .Net CF. In this scenario it would be important to discover this and engage with the customer and platform vendor to negotiate shipment of hardware with the right image components installed.

.Net CF versions:

  • 1.0 -> Old original version, no longer targeted by most development
  • 2.0 -> Good baseline with significant improvements (including performance) over 1.0 (required MS VS 2005 IDE to develop).
  • 3.5 -> Current latest version (required MS VS 2008 Pro IDE to develop).

Windows Mobile versions against their CE base:

  • WM 2003 'Ozone' -> CE 4.20
  • WM 5.0 'Magneto' -> based on CE 5 (shipped with .NET v1.0 SP2)
  • WM 6 .0 'Crossbow' -> based on CE 5.2 (shipped with .NET CF v2.0 SP2 )
  • WM 6.1 -> CE 5.x ? TBA
  • WM 7.0 'Photon' -> CE 6.0? TBD

The next major version of Windows Mobile is anticipated in 2009, but no official details were given. General information suggests a planned release of Windows Mobile 7 in the 2nd half of 2009.

CE 6.0 removes the 32 process and 32Mb restrictions:
  • The 32 process limit raised to 32,768 processes.
  • The 32 megabyte VM limit raised up to 2GB of private VM is available per process.

Technologies:


Microsoft SQL Server 2005 Compact Edition is available (shipped with WM 6.0). This can be used stand alone, or connected to a server side SQL server. Can be synchronised with server DB over network. Async and synch operation is possible. Loads in process as a dll (therefore doesn't use any precious process slots, but of course it will consume RAM/processor). This is a very cut down DB, things such as triggers and stored procedures are not supported.

Ajax, DOM, Javascript is possible in the browser technology (from WM 6.0 onwards).

XML is supported - recommended to use XML readers not full blown XML DOM for efficiency reasons.

XSLT - it was not clear weather XSLT was supported on the platform, either in the browser or as .Net libraries.

Windows Mobile limitations (until WM 7.0):
  • 32 process limit
  • 32Mb memory limit

Windows Mobile can close applications when it starts to run low on resources - so applications should be developed with this in mind. The OS will pick the lowest application in the Z-order that is inactive. Notification events are sent but if the application doesn't respond gracefully it could receive hard termination!

.Net development tools:

Visual studio is the only supported option (no free express version for CF 3.5 available at this time).

Optimisation tools were not generally recommended - they advocate letting it run 'as-is' but rather to concentrate efforts on getting the design right.

It was admitted that profiling tools were somewhat weak at the moment - but this is an area they are actively addressing.

Code signing:

We were warned that some platform vendors have removed the root CA from the device, which means that the only option for getting the application code signed would be to go through the device vendor (this is something that would need to be highlighted and planed in early in the project).

Testing:

The need for thorough and extended testing was highlighted. Mainly due to the additional use cases that can occur on a mobile platform that are less likely or non-existent on a traditional desktop pc system, for example:

  • Memory cards being removed
  • Wireless signal poor / dropped
  • Flat battery, battery removal
  • Unexpected key presses from special function keys on the device

.Net configuration:

It's possible to configure the platform .Net CF using a configuration file:

http://msdn2.microsoft.com/en-us/library/bb629366.aspx

Software updates:

Whilst there is no application support for software updates (apart from the M ) there are some software components that can be used as a basis for providing this, the Mobile Client Software Factory and the Mobile Updater.

http://www.microsoft.com/downloads/details.aspx?FamilyID=F9176708-9F57-4C0F-97FB-F9C65A9BBF22&displaylang=en

http://msdn2.microsoft.com/en-us/library/bb629366.aspx

Additional links and info:

Mobile Dev centre http://msdn2.microsoft.com/en-gb/windowsmobile/default.aspx

Application developer consulting service http://www.microsoft.com/uk/adc

Libraries and widgets:

Mobility Marvels: http://msdn2.microsoft.com/en-us/windowsmobile/bb250537.aspx

Mobile Controls: http://www.asp.net/mobile/

No comments: