A Brave New World
The last three years have been exciting times for architects and developers. Microsoft, in the spring of 2000, first announced a vision for computing termed Next Generation Windows Services (NGWS), which in February of 2002 materialized as Visual Studio .NET (VS .NET) and the Microsoft Windows .NET Framework. These products brought object-oriented programming to the world of Web development and helped mainstream the paradigm of connected applications using XML Web Services.
However, it could be argued that the biggest boon for developers working with Microsoft development tools such as Visual Basic 6.0 (VB), Visual Interdev, Active Server Pages (ASP), and Visual C++ was that the introduction of the .NET Framework unified the programming model. Now, developers could use a common Integrated Development Environment (IDE), core languages, and tools and reap the benefits of rapid application development (RAD) programming inherent in VB, Web server applications with ASP, and powerful object-oriented development with Visual C++. This unification created opportunities for developers to extend their skills into new application areas by leveraging a core set of class libraries tied to a runtime engine and development environment.
Fast-forward a little more than a year. Microsoft has now built on the foundation laid by v1.0 of the Windows .NET Framework by releasing v1.1 and Visual Studio .NET 2003. In this release not only has Microsoft consolidated features released after the initial release to manufacturing (RTM), including ADO.NET Data Providers for ODBC and Oracle, Visual J#, and ASP.NET Mobile Controls--formerly the Microsoft Mobile Internet Toolkit (MMIT)--it has further expanded the reach of developers by including the Compact Framework and Smart Device Projects (SDP). These two together allow developers familiar with the desktop Framework to use the same core languages (VB and C#), runtime engine, and IDE to create applications targeted to smart devices, such as the Pocket PC 2002.
But with this increased opportunity come additional challenges for architects and developers. The key is to understand not only the nuts and bolts of the technology, but how and in what scenarios to apply it when building solutions. This is the reason we wrote this book, and we hope the reason you've decided to read it. That is also why we strive in each section to provide the big picture in order to give you enough technical information to understand the challenges and techniques that can be used, while not getting bogged down in every last detail of implementation. For this reason, you'll notice that we rely heavily on short code snippets, listings, and pointers to other resources.
A Note about Audience
As mentioned in the previous section, we've written this book with architects, technical managers, and developers working in the corporate world in mind. Because these three roles often have a large diversity of skill sets, there may be parts of the discussion that are too detailed for some readers. If you find this to be the case, we urge you to rely on the executive summaries at the beginning of each chapter, which summarize key chapter points. We also recommend looking for the key point icons in the margins. These icons indicate special considerations or, as the name implies, key points that we don't want you to miss.
For other readers the code snippets and listings may leave you wanting more. This is good and done by design; for this reason at the end of each chapter we've included a "Related Reading" section that discusses chapter topics in greater depth. Because some of the entries in the "Related Reading" sections necessarily refer to Web sites, keep in mind that links may change, and you may need to search for the article title, rather than using the address provided. For your convenience, we've placed the links on our site at http://atomic.quilogy.com/cfbook and will do our best to keep them updated.
When considering the skill sets of developers and technical managers reading this book, we specifically had in mind (1) desktop Framework developers and managers who are now embarking on building smart device solutions, and (2) embedded VB developers who are now moving from eMbedded Visual Basic 3.0 (eVB) to the Compact Framework. As you can imagine, the needs of these two groups are inverse to one another. The former require little in the way of managed code and Visual Studio guidance, but more coverage of issues related to developing for mobile devices. The latter are already familiar with building solutions that include mobility but require information on Compact Framework specifics. Because satisfying both audiences is difficult, we've tried to walk a line that balances the two views without leaning too heavily in either direction.
Language Choice
One of the great benefits of working with the .NET Framework is the freedom to work in the language of your choice. This is an inherent benefit of working with code that is compiled first to an intermediate language and then finally to machine code at runtime.
Although the Compact Framework restricts this freedom somewhat through its support for either C# or VB .NET, applications written in either are functionally equivalent and on a par in terms of performance. And as with the desktop Framework, the class libraries that ship with the Compact Framework are the truly interesting part of the product because they encapsulate the functionality that developers will use. All the class libraries are accessible from either language, and so, learning what they have to offer, rather than language-specific syntax, is the key to building both desktop and Compact Framework applications.
For these reasons you'll notice that we included code snippets and listings in one of the two languages (not both, although rest assured that it is possible to translate any C# code to VB .NET and vice versa), although VB .NET is used more frequently to reflect the likelihood that a majority of eVB developers will choose to use VB .NET over C# because of its similarity to the syntax they are familiar with.
The Scope of This Book
This book is organized into three parts: The PDA Development Landscape with the Compact Framework, Essential Architectural Concepts, and Additional Programming Considerations. Each of the parts varies in length, with Part II, which describes the central architectures for handling data, being the largest and consisting of four key topics in five chapters.
The PDA Development Landscape with the Compact Framework
The first part of this book consists of Chapters 1 and 2 and lays the foundation for architecting solutions using the Compact Framework. The goals of these chapters are to put the Compact Framework in the context of mobility (Chapter 1) and to explicate the architecture and core features (Chapter 2) of the Compact Framework and SDP.
Together these chapters are written so that architects and developers will gain an understanding of how the Compact Framework is positioned and why you might want to develop solutions using this technology.
Essential Architectural Concepts
The part on architectural concepts is broken into four key topics that architects and developers typically need to address in their solutions:
- Local data handling. Business solutions that are written using the Compact Framework will typically need to be able to handle relational, file-based, and XML data in order to display it to the user. Chapter 3 addresses this need by discussing how applications can access local data using the support in the Compact Framework for processing XML, reading and writing to files, and using ADO.NET. The techniques in this chapter apply to handling disconnected data, as well as data downloaded from a remote source.
- Remote data access (RDA). Business solutions also have the need for accessing data over the Internet or on corporate networks. Chapter 4 addresses this requirement by discussing various architectures for accessing remote data including XML Web Services, sending HTTP requests, low-level networking using sockets and infrared standards developed by the Infrared Data Association (IrDA), and accessing Microsoft SQL Server 2000 remotely. The techniques in this chapter apply to connected scenarios.
- Robust data caching. Chapter 5 discusses how applications can cache data locally on a device using SQL Server 2000 Windows CE Edition 2.0 (SQLCE 2.0). Most of the discussion will focus on the uses for and features of SQLCE 2.0 because it has many advantages over simply caching data through the use of files.
- Synchronization. Finally, Chapters 6 and 7 discuss ways in which data can be synchronized, including a discussion of simple synchronization with a host PC using ActiveSync (Chapter 6) and following with the RDA and merge replication features of SQLCE 2.0.
Of course, all of these topics reflect the centrality of data access. This is no coincidence, because architecting and developing business solutions involve, in large measure, moving data around, editing it, saving it, and synchronizing it. As a result, in our discussion of the third and fourth concepts mentioned here, we focus considerably on SQLCE 2.0 and how it can be used with the Compact Framework.
This book does not address architecting solutions using Microsoft ASP.NET Mobile Controls (formerly MMIT)--a set of ASP.NET server controls that enables the development of Web applications for a variety of mobile devices--because there are other good resources already available and because the kinds of applications developed with Mobile Controls are fundamentally different from those developed with the .NET Compact Framework.
Additional Programming Considerations
The third part of the book consists of three topics that most mobile solutions will need to address: localization, security, deployment, and developer challenges.
Chapter 8 addresses how Compact Framework applications can be architected to adapt to devices running in different geographies. Chapter 9 is dedicated to the various techniques for securing both the device on which the Compact Framework code runs as well as its data. Chapter 10 discusses techniques for deploying Compact Framework solutions. Finally, the book concludes with a single chapter that discusses some of the challenges developers will face when building solutions with the Compact Framework. Many of these challenges relate to implementing features that are not directly supported by the Compact Framework or that are somewhat difficult to grasp at first.
Final Words
In addition to our consulting and teaching activities, we write technical articles (including some on the Compact Framework) for our Web site at http://atomic.quilogy.com. We encourage you to check out the site and hope you'll use it as a technical resource.
In the end our hope is that you will feel the time and money invested in this book have been worth it because you have taken away important concepts and techniques that you can apply as you build great solutions using the Compact Framework. If you have questions or comments, please feel free to e-mail us at [email protected].
Dan Fox
Shawnee, Kansas
Jon Box
Memphis, Tennessee
October 2003
0321197887P10212003