Choose the right architecture for your Windows Mobile Line of Business (LOB) application

In case you haven’t noticed, mobile LOB is a really hot area right now. It was a major focus point during MEDC and we now have plenty of great collateral that companies can leverage to get started. Check out the Windows Mobile LOB Solution Accelerator, some radical SQLCE Scalability demos, and the Mobile Infrastructure Optimization Maturity Model (thanks Rob!). Oh, and don’t forget that 13 part Mobile Marvels Webcast on LOB solution development (thanks to Maarten!). Back in the day, we only had the demo app shipped with SQLCE (IBuySpy Delivery). Today, you can take your pick….sample apps, case studies, benchmarks, technical docs, and new books on the topic. In my eyes, LOB is hot, resources abound, and life is good… . We’ve got so many resources to lean on *now* compared to a couple of years ago…what’s up?

LOB momentum has been building for some time
Our 2002 platforms were targeted by mostly specialized markets and hobbyists… and it was our first real attempt at a phone platform. With WM2003, we made good strides with the phone parts and added the Compact Framework 1.x to ROM. We also started to integrate WM into Visual Studio which caught the eye of many traditional desktop devs. 2003 Second Edition broke the mold for display barriers and allowed device makers expand the hardware options for the platform (can you say, lots of new device opportunities?) Then WM5 came along and we made some major changes in the platform to standardize common APIs, provide persistent storage, improve security, and make some major advances in our email and sync features. Here we are with WM6 and it provides NETCF 2.0 *and* SQLCE in ROM and delivers on a ton of amazing usability improvements in the Mobile Office apps. Our mobile dev story is also fully integrated in to Visual Studio now which means every developer out there (not just the mobile guys) can get into this game. Meanwhile, compelling devices have been streaming into the market – ruggedized, high-res, square, keyboard, no-keyboard, flip phones, etc. Over 140 devices on my last count and shipping with almost every major operator out there. So here we are…

What kind of application to build?
No matter what your business is, there a Windows Mobile device for you. So, no wonder LOB is gaining momentum. WM is a natural extension of Exchange, Office, SQL Server, and just about every other Microsoft product you use already. Once your workforce has a Windows Mobile device in their hand -- email and office at their fingertips, the next natural question is… HOW CAN I EXTEND MY BUSINESS APPS TO A MOBILE WORKFORCE AND WHAT DOES THAT APP LOOK LIKE?

This answer could become several posts – because you have a LOT of options! The first question is very often…
Should we build a Web App or a Smart Client App?

My opinion is that a Smart Client app is almost always a better way to go today. Many customers I talk to initially want to build a web solution with the intention of using it across mobile device platforms, but this approach has some major limitations. Don’t get me wrong, web apps make sense for certain type of solutions, but there are several reasons they would not be my first choice for a mobile LOB architecture. Let’s look at some pros and cons and ask a few key questions:

Browser-Based Web Application (ASP.NET, HTML, AJAX, etc.) Pros

Centrally deployed and managed on the server

Can be designed to work on Windows Mobile as well as competitive devices and web browsers

Light memory footprint

Cons

  • Loss of network typically means application is unavailable
  • HTTP(S) round-trips can be very slow on legacy networks (and sometimes even on 3G networks) providing a poor UI experience
  • User interface limited to HTML and browser capabilities
  • Local client data is largely unavailable (unless you want to build ActiveX controls to get to everything)

Smart Client – (Compact Framework, SQLCE, etc.)
Pros

  • Rich Platform APIs available for user interface and platform access
  • Works well in online *and* offline mode
  • User interface is fast and responsive
  • Rich UI capabilities through Windows Forms, DirectX, and more
  • SQLCE and rich data/storage APIs available

Cons

  • Must be deployed to the device
  • Application is not usable on competitive platforms
  • May consume more local resources (memory, storage)

Weighing it all out…
There are plenty of other criteria we could talk about, but this is a good place to start. If you are trying to target multiple platforms or just want to provide something like a simple data report, then a web app makes sense. Many browser applications are fairly easy to make work on mobile devices. Heck, if you already expose a browser-based business app to your remote users on laptops/desktops—it may likely “just work” on a Windows Mobile device as-is. The problem is that if you lose network coverage, you LOB app is dead and that’s never a good thing (especially in poor coverage areas). Not to mention, unless you build some really slick AJAX work into the app, you are making frequent “round-trips” to the server every time you do something. I hate using web apps that do this….even on the desktop. On a slow mobile device using a slow network, it’s even worse. Believe me, no mobile LOB user wants to deal with that experience when they are in front of a customer building a sales order. Now – if you are going to head down the road of building a browser-based mobile application, be sure to bookmark the Explore Mobile team blog. They have documented a wealth of really important and useful information you won't find in the WM SDK. This site will be your friend.

Smart Clients do it all. They require you to deploy your app as a simple CAB file and that means a little distributed maintenance, but that's a small price compared to what they deliver. They gives you the best of the web and device capabilities. A well designed client can automatically check for updates and nearly maintain itself. The Compact Framework (NETCF) makes it really easy to build apps that play well with the web, web services… and whatever data requirements you may have. You can access or sync new data when a connection is available and work offline when it’s not. It’s quick and it’s powerful. This is a key requirement for many LOB applications. Building a Smart Client gives you full reign of all our platform APIs and technologies. Whether it’s SQLCE, an embedded browser, MSMQ, DirectX, GPS, Camera, Pocket Outlook, or any web service you want to talk to … it’s relatively easy to do so. Our platform is your workshop. A well built Smart Client is fast and responsive and makes a great LOB solution.

Break it down some more…
A) Does it need to work when a network is not available?
If so, go Smart Client. If you will always have a network, then a web app may make sense if the response time (round-trip) isn’t an issue.

B) I have data needs! My mobile users will need quick access to business data, the ability to update it, and a way to keep it all synchronized in the field.
If so, consider Smart Client paired with SQL Server Compact Edition based on the size of your data. For simple data needs, you can wrap your own web services to push data around, but SQLCE provide merge and RDA replication with SQL Server out of the box to solve these problems. It does this over HTTP(s) and makes it easy to push data out to mobile users and resolve conflicts. If you think there is a chance you will need to handle conflicts with multiple people changing the same data, SQLCE merge replication is your friend (you don’t want to build this yourself).

-Reed