Developing using Pocket Internet Explorer
No discussion of Pocket PC development would be complete without mentioning Pocket Internet Explorer (PIE). As a thin client PIE does a wonderful job of scaling full size HTML pages and graphics to a more manageable form factor suitable for the Pocket PC. PIE is a blend of desktop browser functionality; supporting
- the HTML 3.2 specification
- SSL version 2.0 and 3.0
- MS JScript
- MS IE 5.0 XML support
PIE’s state detection will also detect whether or not the device has a current internet connection and redirect requests to cached pages as appropriate. Perhaps the most compelling aspect of PIE is the XML support. Wireless communications coverage and bandwidth really dictate the boundaries of the type of solutions we can deploy on the Pocket PC. XML used in conjunction with XSL style sheets can mitigate some of the wireless bandwidth issues; by rendering XML in PIE using XSL we have the option of only transferring the data updates we need and letting the device do the work of rendering the HTML via XSL. This saves the server the workload and the bandwidth requirements are reduced – we are only passing the data elements onto the device and avoiding the redundant presentation logic – since this is already on the device courtesy of the existing XSL style sheet.
The Database Dilemma
Well perhaps it isn’t really a dilemma more of a question of how much data you need to store and manipulate and whether you need replication or not?
The native Windows CE data store is called CE DB and can be accessed via OLE DB using ADOCE. CE DB had a few issues relating to performance, which really meant that it was destined for non-enterprise consumer type applications. The advent of SQL Server CE brought a robust performance option to the Pocket PC platform. The fact that it runs in as small a footprint as possible in RAM (under 1MB) means that there are some compromises but on the whole it delivers offering:
- Merge replication with SQL Server 2000
- Remote data access to SQL Server 6.5 and up
- Optimized query processor and support for transactions
- Scrollable and forward only cursor support
- Familiar SQL grammar
- Support for global unique identifiers
- Replication is achieved over HTTP and SSL
Finally we get the .NET Compact Framework
Perhaps there is some light on the horizon for developers in the form of Microsoft’s .NET vision, which will provide us with a managed code development environment. As a professional developer I have found that one of the biggest hurdles I faced in adapting to the .NET paradigm was sorting out road map of what it all meant for desktop development and subsequently how it translated into the mobile device arena.
The most common.NET terms you will be exposed to by someone evangelizing the vision are:
- .NET Platform
- .NET Framework
- .NET Compact Framework (CF)
- Visual Studio .NET
- Visual Studio .NET Smart Device Extensions (SDE)
- Common Language Runtime (CLR)
- Microsoft Intermediate Language (MSIL)
- Just-In-Time Compiler (JIT)
The .NET platform is Microsoft’s soup-to-nuts OS and application environment. This encompasses the hardware; from Windows PC’s to Pocket PC’s and tablets; the XML web services which consist of reusable modular components consumed as services (i.e. the building blocks of the language) and the development environments such as Visual Studio .NET. Basically it’s the new stable of Microsoft tools and software you would use to build distributed applications.
It follows that the some sort of application model or methodology is required to develop against the .NET platform - this is called the .NET Framework. In the shell of a very small nut some of the features of the .NET framework are:
- it is object-orientated
- managed code minimizes deployment and versioning conflicts
- there are fewer differences and increased consistency between windows and web applications
- self describing applications (no more DLL hell)
- much better performance
The .NET Framework includes the class libraries and the Common Language Runtime (CLF).
As mentioned earlier utilizing a mobile devices means sacrificing some power and functionality that would otherwise be available in the desktop environment and this brings us to the .NET Compact Framework - a subset of the .NET Framework tailored to the needs of mobile devices, or as Microsoft calls them - smart devices - Pocket PC’s, smart phones and other PDA’s – mobile devices with internet connectivity. The .NET Compact Framework includes much of the functionality of the .NET Framework except for those services that are comprised by the restrictions of mobile computing - memory, CPU speed and interface issues.
Where it all gets exciting from a development perspective is when we talk about managed code. To adequately explain this we need to delve a little deeper into the overall architecture of .NET. If you have any developer blood coursing through your veins you will have heard the terms Common Language Runtime (CLR) and Microsoft Intermediate Language (MSIL) bandied about this last year. From a coding perspective the CLR is where the rubber meets the road. The CLR manages memory, security, versioning and debugging. Initially only VB and C# will target the .NET Compact Framework and be supported on the Pocket PC. The CLR will support similar functionality across both of these language specifications. This in itself is a boon to developers since the same type systems are now common to all .NET languages. For example, an integer in C# is the same as an integer in VB. The term managed code applies since the same code can be managed or compiled for different runtime environments. Managed applications are target platform independent and do not need to be recompiled in the traditional sense for different platforms - they run on top of the specific CLR for the targeted platform.
When you compile your code in .NET the compiler creates processor independent Microsoft Intermediate Language (MSIL). This code will run on any targeted platform for which there is a Microsoft .NET Framework - in the instance of the Pocket PC platform you would require the .NET Compact Framework. Beginning to see the picture?
But wait it gets better! Before you start to think that this is all well and good but isn’t this just interpreted code? The last part of the managed code execution process is the Just-In-Time compilation where the IL code is compiled into native code for the specific CPU platform you are coding! This is performed once, on a step by step basis as each function is executed. Once compiled the code segments are reused without any additional compilation overhead.
How do you access this mobile device development utopia? The Smart Device Extensions (SDE) for Visual Studio .NET provide the IDE access to the .NET Compact Framework. Currently the Smart Device Extensions are a separate download but in the future they will be integrated into Visual Studio .NET. The .NET Compact Framework Technology Preview that was released at the October 2001 PDC conference will be replaced by a Beta version.