Much has been written about the new technical features available in version 2 of the .Net Compact Framework. In this post, I’ve tried to take a “higher level” approach by describing the product in terms of the benefits it can bring to a organization. This post is targeted at those who are currently analyzing whether to upgrade from version 1 of the Compact Framework to version2.
The introduction of the new version of a software platform often causes enterprises to go through an analysis to determine whether the benefits realized in the new platform will offset the costs of upgrading. Version 2.0 of the .Net Compact Framework represents the experience gained by working with customers since the initial version was released in early 2003. During that time, the Compact Framework team has made significant investments in performance, developer productivity, stability, supportability and new features that make this release very compelling. This document describes the new capabilities of the Compact Framework from the perspective of an enterprise analyzing the business justification for upgrading.
Applications run faster
Increasing application performance was a primary goal of version 2.0 of the .Net Compact Framework from the very beginning. Investments were made in every product area to ensure that applications run faster across the board.
In some cases, performance increases were obtained by tuning existing code paths that had proven to be critical to performance. In other cases, entire areas of the product were substantially reworked to significantly increase performance. Many of these investments were made at the lower levels of the product in order to improve the overall performance of all applications, regardless of which features they use the most. For example, significant changes were made to the way the .Net Compact Framework allocates memory. In version 1.0, the Compact Framework could allocate approximately 1 million small objects per second. Due to changes in the memory allocation scheme, version 2.0 of the Compact Framework now allocates 7.5 million small objects per second. Performance gains on a similar scale have also been achieved for other common low level tasks necessary to run an application, such as compiling code, calling methods and on.
These key changes to low level algorithms, along with some targeted performance work in other areas of the product, have a direct affect on application-level tasks such as accessing data and calling web services. For example, a typical data access test used by the Compact Framework team completes in just over 3 seconds in version 2, while the same test took 13 seconds to run in version 1. Web Service performance is also up measurably in version 2. The overall performance of a Web Service call can vary drastically with network conditions and other external factors, but in general the cost of making a Web Service call is up on the order of 50%.
The performance improvements seen for your application depends in part on how it is built, but in general applications start faster and run much faster on version 2.0 of the Compact Framework.
Developers are more productive
Developer productivity has always been a hallmark of the .Net programming model. Concepts such as automatic memory management have been a key enabler of developer productivity since the inception of the .Net Compact Framework.
Developers are more productive when fewer steps are required, and there is less code to write to accomplish common tasks. Productivity is increased even more when the underlying platform provides built in implementations for those steps that are typically error prone. Such infrastructure increases productivity in the long run by reducing the occurrence of common programming mistakes.
Version 2.0 of the Compact Framework helps increase developer productivity in four key ways:
- New programming language features. C# and VB.Net language features such as generic types and anonymous methods reduce the amount of “boilerplate” code a developer needs to write. Generally speaking, the less code the developer needs to write, the more maintainable the system is and the better it performs.
- Enhanced infrastructure for calling existing code. Most .Net Compact Framework programs access existing native code components as part of the overall application solution. In version 1 of the Compact Framework, developers often had to write custom code that transferred data between the C# or VB.Net program and the existing native components. Not only was this additional code to write by hand, but it was often complex and error prone. Version 2.0 of the Compact Framework provides new infrastructure such that the instances in which developers had to write custom code to interoperate with native components is dramatically reduced or completely eliminated.
- Extensions to the base class libraries. One of the reasons developers are so productive on the .Net platform is the existence of a vast set of class libraries that can be reused to perform common tasks. In version 2.0, the .Net Compact Framework provides a broader set of class libraries than it did in version 1.0. After version 1.0 was broadly adopted, the Compact Framework team did extensive customer research to determine which additional classes were most commonly requested. Some of the additions are extensions to already existing portions of the class library. For example, several new properties, methods and events were added that make it easier to interact with user interface controls. In some cases, however, the class libraries that were added make it possible for C# and VB.Net applications to directly access entirely new features. For example, the addition of the System.Messaging namespace makes it much easier to write an application that behaves well in transiently connected scenarios by taking advantage of durable messaging. For example, applications that transfer data only when they are cradled are now much easier to write and much more reliable.
- Improvements in the visual editors. Microsoft Visual Studio allows developers to author portions of their applications using graphical editors rather than by writing code. Developers have an even more productive authoring experience in Visual Studio 2005 through improved graphical layout tools, new emulator support, the ability to reuse common snippets of code and so on.
Applications are easier to debug and support
A key element in an organizations ability to control overall systems cost is the degree to which a product can be supported after it has been deployed. .Net Compact Framework version 2.0 adds numerous new capabilities that make it much easier for developers and support personnel to determine what has gone wrong when a user encounters an error. These new capabilities include application tracing and logging, a new set of performance monitoring tools and the facilities to help developers accurately pinpoint errors in their code.
Most .Net Compact Framework subsystems now include some form of logging. Logging can be enabled to trace data elements such as network traffic, the interaction between C# or VB.Net code and native components, and other internal workings of the Compact Framework. These logs can help identify both applications errors and inconsistencies in the environment the application is running in.
Device applications must be conscious of the resources they use because devices typically have much less computing power and resources than desktop computers. Without good diagnostic tools, it’s very hard to determine what is causing an application to work poorly when resources are low. Fortunately, .Net Compact Framework version 2.0 provides performance monitoring data and a graphical tool that allows that data to be analyzed in real time. These tools enable a developer or support person to directly see how the application is using resources and where the bottle necks are. The following graphic shows how the Windows Performance Monitor can be used to understand the memory usage patterns of a .Net Compact Framework application running on a device.
When errors do occur in code, the .Net Compact Framework helps the developer isolate the error by providing a “stack trace”. A stack trace is a textual description that shows the developer exactly where in the program an error occurred.
The .Net Compact Framework team continues to invest in debugging and diagnostic tools. As more tools are added in subsequent releases, these tools will target version 2.0. No further diagnostic tools are planned for version 1.0.
Developing secure applications is much easier
Application security is a concern for all enterprises given the proprietary nature of the data needed to run the business. Developing secure applications is easier with Compact Framework version 2.0 in 3 ways. First, the Compact Framework runtime is more tightly integrated with the Windows CE security model such that the possibility of loading unsigned code can be eliminated. Second, the support in Visual Studio to debug a trusted device is completely automated. Visual Studio can be configured to sign all binaries before deploying them to the device for debugging. The third way in which .Net Compact Framework 2.0 makes it easier to build more security applications in the presence of a new set of cryptography class libraries. These class libraries simplify common cryptography tasks such as encrypting data and digitally signing files.
Access to Data is faster and more scalable
Most all enterprise device applications store data locally on the device. In many cases, data is kept on the device only temporarily until the device is connected to a network or cradled. Access to data is typically a performance critical operation if for no other reason than the data typically has to be loaded from storage such as a flash card or other media.
SQLMobile is a popular choice for storing data on a device. Applications that use .Net Compact Framework version 2 can take advantages of several new features in SQLMobile 2005 aimed at making access to data faster and more scalable. Accessing data through SQLMobile 2005 is made faster through a software component called the SqlCeResultSet. In most cases, accessing data using Compact Framework 2.0 and the SqlCeResultSet is several times faster than accessing data using previous versions of the .Net Compact Framework. Much of the performance gain realized by the SqlCeResultSet are the result improved algorithms that eliminate the need for data to be copied multiple times as it is read from the database and made accessible to the application.
The following chart shows the increase in performance achieved using .Net Compact Framework version 2 for some typical data access and XML tests.
Increased performance is not the only benefit available to applications that access data using version 2 of the .Net Compact Framework. Applications are also able to achieve much greater scalability due to support for multiple users and multiple database connections in SQLMobile 2005. These new features allow an application to have multiple data access requests outstanding simultaneously, thus reducing the need to wait until one request is done before starting another.
Developing applications that access data is also made much easier by new design features in Visual Studio 2005. The use of data design tools allow a developer to author the data access portions of the application graphically instead of writing custom code. The use of data designers is one more example where Visual Studio 2005 and .Net Compact Framework version 2.0 reduce the code that developers need to write in order to accomplish common tasks.
Developers can build more sophisticated user interfaces
Improvements to the display hardware on devices coupled with support for additional controls and graphics capabilities in the latest versions of Windows CE and WindowsMobile provide an underlying platform that supports the development of very sophisticated user interfaces. .Net Compact Framework version 2.0 makes these advances accessible to VB.NET and C# applications by providing support for the most recent user interface controls, graphics programming interfaces, and screen orientations.
New controls in version 2 of the Compact Framework include those to help organize and browse documents and web sites and to select dates and times. The addition of controls such as these enables developers to build more user interfaces “out of the box” without having to write or buy as many custom controls. However, should the need to write a custom control arise, Visual Studio 2005 makes it easy by providing visual support in the development environment for writing controls that satisfy a need specific to your application.
Applications can also display sophisticated 3 dimensional graphics, such as those used in games, through a .Net interface to the Direct3D graphics library.
The Compact Framework now also makes it easier to write user interfaces that must work on a variety of screen resolutions and orientations. For example, support for “docking and anchoring” enables a developer to write an application whose user interface dynamically adjusts when the screen orientation or resolution changes on a device.
Platform stability and security continues to increase
The first version of the Compact Framework was released in the early 2003. Adoption of the Compact Framework has steadily increased to the point where there are now over 10 million devices that ship with the Compact Framework in ROM, over 200,000 Compact Framework developers and over 600,000 downloads of version 1.0 Service Packs. Broad customer adoption such as this has enabled the Compact Framework team to gather large amounts of data about the overall stability of the product. Armed with this data, the Compact Framework team has been able to rapidly increase the maturity of the platform by fixing defects reported by customers.
In addition, the team now uses several automated tools to highlight areas of the code that may be vulnerable to security attacks. In addressing these issues, the Compact Framework team has reduced the likelihood that the applications it runs will be susceptible to known security attacks.
A Word about Application Compatibility
One of the biggest concerns an organization typically has when considering an upgrade to a new version of a platform is the level of compatibility that platform provides with previous versions. Compatibility is of critical importance to a broadly adopted platform such as the .Net Compact Framework. Without the ability to run applications built with earlier versions, a platform’s momentum slows quickly and its long term viability is all but eliminated.
To ensure the continued success of the Compact Framework, the product team has built an in-house compatibility lab to ensure that existing applications continue to run on new versions of the platform. Before shipping version 2.0, the product team tested over 650 commercial version 1.0 applications to make sure that compatibility issues were discovered and addressed to the greatest extent possible. When incompatibilities were found, changes were made to the Compact Framework such that existing applications continued to work as they always did.
This posting is provided “AS IS” with no warranties, and confers no rights.