Browse DevX
Sign up for e-mail newsletters from DevX


Mobile CoDe.NET: Microsoft Mobility 101 : Page 5

Does Microsoft have a real development solution for handheld devices or will other vendors continue to grab the spotlight? Here in the first installment of Mobile CoDe.NET, we'll describe the OS choices and software development tools and we'll lay out the yellow brick road that you can follow to start building your own mobile solutions.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

.NET Compact Framework
The palm (no pun intended) for single biggest innovation in mobile Windows powered computing since Windows CE goes to the .NET Compact Framework, which is the mobile cousin of the desktop and server-oriented Microsoft .NET Framework. In most respects, you can think of the .NET Compact Framework (.NETcf) as a .NET Framework "Light Edition" since Microsoft has scaled it down to less than 2 MB. While some compromises were necessarily made to reduce the .NET platform's memory footprint for Windows CE, the most powerful features are still there, including the CLR, support for many languages, CPU-independent IL binaries, a library of base classes, and much more. Having reached Gold status in Fall 2002 and released commercially in April 2003, the Microsoft .NET Compact Framework 1.0 is targeted for Windows CE .NET 4.1 and higher development only. The sole exceptions are devices running Pocket PC 2000 and 2002. These are the only Windows CE 3.0 specs supported by .NETcf and Microsoft has been so adamant on this I doubt you can expect more support for .NETcf on Windows CE 3.0. .NETcf's direct competitor is none other than the Java 2 Micro Edition (J2ME) which—like its big brothers J2SE and J2EE runs on several operating systems including the Palm OS, the Symbian OS, Windows CE, Embedded Linux, and others. J2ME can even run as a mobile operating system on its own, which you can see in BlackBerry devices from Research In Motion (RIM).

The CLR in the .NET Compact Framework shares many commonalities with the full version, such as garbage collection, JIT compilation, verifiable type safe execution, error handling with exceptions, a common type system, and CPU independence. This last item is key to Windows CE development which previously required a different compiled binary for any supported CPU. Since the .NETcf CLR is available for all the CPUs supported by Pocket PC and Windows CE .NET (including MIPS, SH-3, StrongARM, x86, etc.), you only need a single IL binary for compatibility across the board. .NET Compact Framework IL assemblies even share a binary compatibility with the full version and can run in the .NET Framework's CLR with no changes since they are "retargetable." That is, provided the code does not reference any features unique to the .NETcf. Not everything is the same though, (which you had to expect by now). The base class library is roughly a 25-30% subset of the full framework... still impressive! Another gotcha limits the .NETcf to two languages only: Visual Basic .NET and C#. It may sound like a bummer when measured against the full framework, but I always remind people that a fair evaluation of the .NET Compact Framework should compare it with the alternatives that is, the Embedded Visual Tools 3.0 and competing products. Other framework features were removed, either because they didn't make sense or couldn't exist on Windows CE, such as ASP.NET, classes associated to Directory Services, COM+, WMI, NT services, role-based security, and others, or because the cost in resources and memory was too high. Features in the latter category include COM Interop, .NET Remoting, generic serialization, reflection emit, install-time JITting (nGen), classes related to configuration files, MSMQ CE access, XSLT and XPath, and others.

Development on the .NET Compact Framework is integrated directly in the Visual Studio .NET 2003 IDE through the Smart Device Extensions (SDE). The SDE enable you to select new project types for VB or C# solutions and build these applications within the same environment you have learned to love over the last year. Unlike beta versions of the .NETcf and SDE, you unfortunately cannot add the SDE to the "original" version of VS.NET (2002 if we can call it that), an upgrade to VS.NET 2003 is mandatory.

Should you deploy local code on your devices or serve them mobile Web pages from a Web server?
If wish I could tell you all about the .NET Compact Framework right away, but that will have to wait for a dedicated article covering a deeper look into the .NET Compact Framework in an upcoming installment of Mobile CoDe.NET.

ASP.NET Mobile Controls
If a Web-based approach tickles your fancy when it comes to mobile development, you'll want to give the ASP.NET Mobile Controls a spin. Formerly known in the first release of Visual Studio .NET as the Microsoft Mobile Internet Toolkit (MMIT), this toolkit allows you to build mobile Web applications for over 200 mobile devices of all types using just a single ASP.NET Mobile Controls project. Once you've installed them during setup, ASP.NET Mobile Controls provide you with one more project option—ASP.NET Mobile Web Application—to select from when you start a new Visual Studio .NET project. And contrary to the .NET Compact Framework's limitation to VB and C#, you can leverage the ASP.NET Mobile Controls from any ASP.NET-compatible language. When building a new Web application with the ASP.NET Mobile Controls, you still benefit from a Web Forms Designer, albeit this one is "mobile". It features an array of "smart" controls that support adaptive rendering, which is the ability to "draw" itself and behave correctly regardless of the mobile device's browser environment. This results in mobile Web pages and applications that you can access from Windows CE devices, Pocket PCs, Palm devices, BlackBerry devices, WAP-based Internet phones, Smartphones, and more. In fact, when it was released in February 2002, ASP.NET Mobile Controls supported a number of devices equivalent to more than 80% of market share in mobile devices worldwide. Microsoft since then published two additional device updates that—once installed on the ASP.NET server—enable support for even more devices without altering a single mobile Web project.

ASP.NET Controls applications are built like a deck of cards, where a single mobile ASP.NET page can host many mobile Web forms. Your code simply references the right form—or "card"—based on which one you want to return to the mobile user. Many mobile Web controls are available as shown in Figure 1, and just like other ASP.NET projects, you can extend these controls and design your own. At run-time, HTTP requests from mobile devices are dissected—thanks to the User Agent string—to identify which browser is running on the client device. A catalog of devices is then accessed to retrieve the list of features supported and not supported on this device, such as page type (HTML, CHTML, WML, etc.), screen width and height, support for color, graphics, scripting, CSS, ActiveX controls, java applets, XML and countless other attributes relevant to client-side processing. Once these capabilities are assessed, the mobile Web Form and controls render themselves based on the supported features, the page is JIT compiled once and then returned to the device for display.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date