Summary The .NET Compact Framework is a rich managed-code runtime for mobile devices suitable for building a wide range of applications, components, and frameworks. It was designed from the ground up for use in resource-constrained devices but with the specific design goal of being a binary-compatible subset of the desktop and server .NET Framework. As with other modern managed-code runtimes, the .NET Compact Framework consists of a native code execution engine and a managed-code set of class libraries that run on top of it. Design strategies specifically tailored for mobile and embedded devices were employed to both provide a rich subset of desktop .NET Framework functionality and to meet size and performance goals for mobile devices.The class libraries that ship as part of the .NET Compact Framework version 1.1 can be thought of as consisting of five logical blocks: (1) user interface and graphics support, (2) XML support, (3) Web services client support, (4) data-access support, and underpinning all these, (5) base class libraries. The base class libraries were designed to give desktop developers a very comfortable and empowered feeling when writing code for devices; all the basic features developers expect should be there. The combination of these libraries gives developers a rich palette of functionality with which to design business-, productivity-, scientific-, and entertainment-oriented applications. Future versions of the .NET Compact Framework are likely to add support for code-access security models as well as for multimedia support.When building applications that run on managed runtimes, particularly on mobile devices, it is useful to have a good conceptual understanding of how the runtime is managing the application's memory and execution. The .NET Compact Framework offers JIT compilation of code as well as garbage collection of memory the application uses. Under normal execution circumstances, only object memory needs to be garbage collected and compacted periodically. In cases of severe memory pressure, code that has been JIT compiled can be thrown out and garbage collected as well to reclaim needed space. Just as it is possible to run out of memory in native code applications, it is possible to cause severe memory pressure in managed-code environments as well. This results when an application uses up all available memory through object allocations. In these kinds of circumstances, application performance will decline drastically as the managed code garbage collector struggles to reclaim a dwindling amount of memory. The application will be forced to fail if the necessary memory allocations cannot be made. Memory pressure is a situation to be avoided, and the subsequent chapters in this book will spend a significant amount of time discussing how to design algorithms and build applications that efficiently work with device resources such as garbage-collected memory.Managed-code runtimes such as the .NET Compact Framework offer developers great advantages when building mobile device applications. The productivity and reliability of managed-code environments and the presence of rich class libraries and components for code reuse are compelling. However, developers still need to have a good conceptual understanding of how memory and code execution is being handled to make the most of these advances in mobile application platforms. This knowledge coupled with device-specific design and engineering skills will enable you to build great mobile applications. |