Squeezing .Net into 2MB

Compact Framework product manager shares some tips for programming with limited memory

Jonathan Wells, the product manager for the Microsoft .Net Compact Framework, toured the country last week showing .Net user groups how easy it is to write applications for mobile devices.

The compact framework is a stripped down version of the full .Net framework, designed to make it as easy as possible for desktop developers to write mobile applications.

A mobile application can run on a number of device types including tablets, Pocket PC gadgets, Pocket PC Phone Edition and mmartphones.

Microsoft has taken the full .Net framework which has a 16MB static memory footprint and removed large chunks of non-essential code so that it fits into a 2MB ROM. Making the .Net platform run on such a small hardware base does pose some challenges.

“Sixty to 70% of development effort is spent following execution paths to improve performance,” Wells says — a development culture that could usefully be applied in many other arenas.

As demonstrated by Wells, the actual process of developing a simple data grid application with an open and close button is essentially trivial in Visual Studio.Net. The only real difference from a desktop application was the fact that he decided to publish his data with a web service rather than a straight database connection. Running the application in Visual Studio brought up an emulator that provided a reasonable facsimile of the real user’s experience.

The skill in producing Windows Mobile applications is not in the coding but in the design. The current version of the platform is severely constrained by the hardware envelope. Also, the users assume an application will continue operation in a disconnected situation. This implies some forethought into graceful degradation.

So while the actual coding is really easy, performance issues relating to garbage collection and network latency in particular means that a mobile coding style will evolve in a team that is significantly different from normal desktop standards. It seems appropriate to start with a small application and assume that the first version will be consigned to the bin fairly quickly.

For organisations that use regression testing, it is also worth checking how the emulator responds to their regression testing tools.

The process that the .Net Compact Framework team uses for integrating the software from a large number of developers is enlightening. Before a developer can promote software into the daily build, they have to “run the gauntlet", Wells says. This is a subsidiary build process with a few regression tests. Once those tests are passed or changed, then the developer can promote their code to the main build and testing farms, he says. Just to give an idea of the scale of this endeavour, when C# was being developed with the system class libraries, there were over 200 workstations dedicated to running regression tests on C# alone, Wells says.

Wells’ description of life driven by a daily build process with regression test reports each morning bears a striking similarity to development in early mainframe days, with punchcards sent off one day and a pile of line-flow paper returning the following morning.

At Microsoft, each team is responsible for its own testing harnesses and technologies. This does avoid the conflicts and non-delivery that often occur in big software projects when QA is a separate function. Rather than specific testing tools, Wells says, his team builds parallel testing classes that use the Accessibility API to drive the main application. This does mean that the visually impaired can be assured that .Net Compact applications will be accessible.

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags mobile.Net compact framework

More about Microsoft

Show Comments
[]