n today's world of fast food, fast cars, and instant gratification, people expect to be in touch at all times. We have become conditioned to staying in touch with businesses, friends, and families. Because of this desire for instant data, we have the Internet, cell phones, Wi-Fi, MP3 players, and DVD players. As the equipment needed to drive this thirst has become smaller and smaller, we find ourselves looking for portable replacements for our bulky desktop computers.
This article guides you into the exciting world of Windows mobile development so you can take advantage of an expanding opportunity to supply software to this burgeoning market.
There are currently two choices for producing mobile software using a Windows operating system: ActiveSync on XP, and—for Vista—a new interface built upon ActiveSync technology, called the Windows Mobile Device Center (WMDC).
In the recent CoDe Focus issue on Mobile PC Development (2007, Volume 4, Issue 2), Nick Landry's article entitled "Windows Vista Mobility: Why Should You Care?" provides a good review and tutorial on using WMDC with Vista. If you're going to use WMDC, you'll definitely want to read this article.
If you are using Vista, download the WMDC from Microsoft's site; if you're using XP, download ActiveSync. The remaining software requirements are not operating system dependent. When you install Visual Studio 2008, the .NET Compact Framework and SQL Server Mobile Edition are also installed. Visual Studio 2008 is required to use the latest version of the different frameworks. If you plan to develop for earlier versions of the Compact Framework, you can use either Visual Studio 2008 or 2005.
The Compact Framework
The Compact Framework is the vehicle for mobile development. How does the Compact Framework differ from the full version? For starters, Microsoft removed most of the nice-to-have method overloads and non-essential functionality, giving the Compact Framework a much smaller footprint. Distilling the regular framework to a size that can be installed onto a device with limited memory and disk capacity must have been no easy task. However, the Compact Framework provides nearly everything you need to develop for smart phones and Pocket PCs. It does not provide support for:
- Click-once deployment
- Web Forms
- Configuration files
- Binary serialization
You can easily replace most of the missing functionality with custom code or solutions available from third-party providers.
SQL Server Mobile Edition (SQLme)
SQLme is a subset of regular SQL Server that works with both SQL Server 2005/2008 and the Express versions of each product. The majority of necessary functionality is there. You can use the SQL Server Management console to manage your SQL Server mobile database on the desktop or on the PPC through a direct connection.
There are a few limitations to using SQLme:
- No stored procedures
- No batch queries
- Limited table design
The lack of stored procedures is not a big problem to overcome. It is easy to simulate stored procedures using TableAdapters, because you can create as many methods on the TableAdapter as you need. Then, when you need to make a data call, you can refer to the method name instead of a stored procedure. If you choose not to use TableAdapters, you can simply add methods to your data layer to accomplish the same task.
Missing batch query capability is again not much of a hassle with disconnected data. You probably won't be performing massive amounts of data munging or extraction on the mobile platform. Most basic data operations on a mobile platform involve simple data retrieval and update. Because you make these retrieval requests through a data layer, it makes no difference if the commands are processed together or one at a time.
Limited table design is not a real problem either. The most frustrating thing about using the table editor in the management studio is that you cannot move columns around in your design without deleting them and recreating them in the desired order. The workaround is to make sure your design is what you want before you create a number of tables. Otherwise, the table design process is like the regular SQL Server version; you have a wide range of data types to support your requirements.
|Editor's Note: This article was first published in the July/August 2008 issue of CoDe Magazine, and is reprinted here by permission.|