Writing Mobile Code Essential Software Engineering for Building Mobile Applications [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Writing Mobile Code Essential Software Engineering for Building Mobile Applications [Electronic resources] - نسخه متنی

Ivo Salmre

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید













Ways to Develop for Devices



Quite a few technologies can be used to build applications for mobile devices. Much like desktop computers, the two primary models for application development are the server-based Web application approach and the smart-client approach. This book specifically concerns itself with smart-client applications for mobile devices, but for comparison it is worth having a brief overview of both application models for mobile devices.


Server-Based Applications for Mobile Devices



Server-based applications are commonly referred to as "browser applications." They offer a great deal of flexibility. Attractively, they require no "on-device footprint" other than the presence of a generic mobile browser application on the device. The downside of this approach is that like other Web-based applications, mobile Web applications require a continual server connection and do not offer the richness and responsiveness of an on-device solution. The connectivity requirement is important to consider because unlike desktop computers mobile devices frequently go in and out of connectivity while their users are roaming around in the physical unwired world. However, if your application only needs to run when the user is connected and you want to target the largest range of devices, it is certainly worth considering a mobile Web-based solution.



Note


Many technology choices exist for supporting Web-application development targeting mobile devices.
In addition to Microsoft ASP.NET''''''''s mobile controls, other Web-application technologies also support application development targeting mobile devices. These offer their own strategies for making Web applications geared toward mobile devices. If there is a popular Web-development technology you are using, chances are that there is a mobile device targeting extension available for it.


Microsoft''''''''s technology for Web applications is called ASP.NET (Active Server Pages .NET). ASP.NET offers ASP.NET "mobile controls" for targeting mobile devices. Visual Studio .NET 2003 enables developers to build ASP.NET mobile device applications. Figure 1.1 shows the new project dialog in Visual Studio with the Mobile Web Application option selected.



Figure 1.1. Beginning a new ASP.NET mobile Web application.


[View full size image]




Creating and designing a mobile Web application works much in the same way as creating and designing Web applications targeted at desktop Web browsers, with the following major differences:



Design surface
You are provided with a design surface that is specifically mobile device oriented with a simplified and streamlined control layout paradigm suitable for mobile applications.



Device-targeted controls
Instead of the norma146 set of controls, you are provided with a set of Mobile Web Forms controls to work with. These controls are specifically designed to render properly for a wide range of devices. Also offered are some controls specific to mobile devices, such as PhoneCall control.



Rendered markup language
At runtime, the Mobile Web Forms controls run on the server can generate Wireless Markup Language (WML), Compac153 (cHTML), o151 depending on the capabilities supported by the requesting device''''''''s browser.




The server-side runtime takes on the burden of determining what the best display experience is for the mobile device interacting with it based on information the mobile Web browser submits with its request. Out of the box, the ASP.NET Mobile Web application technology supports a wide range of devices. Support for new device types can be added by Microsoft, device manufacturers, or end developers wanting to target a device type not yet supported by the framework.


To access mobile Web applications, a device needs to have a capable mobile browser application present. There are many kinds of mobile browsers, the most common being the previously mentioned WML, cHTML, an138 browsers. Most modern smart phones come with some kind of Web browser technology installed.


You can find a great deal more information on ASP.NET mobile applications in the online documentation. (The "Mobile" section of [http://www.asp.net] is a great place to start.)


Smart-Client Mobile Applications



This book focuses on software engineering for smart-client mobile applications. When you decide that your mobile-device application will work best as a rich client application, you have another basic decision to make. You need to decide which client-side technology to use. Will the application be written in native code or will you use a managed code solution? Both have benefits and drawbacks.


Native Code



Native code development is usually done in C or C++. Native code is useful when you need the absolute maximum performance from a system or need low-level access to the hardware. However, native code has some significant drawbacks as well, including the following:



Native code development is less productive than working with managed code.
Because you are working at a lower level of abstraction, you will spend more time coding.



Native code is processor dependent.
When you compile to native code, you are generating instructions specific to the microprocessor you are targeting. This means that if you want to target more than one processor family, you must compile and deploy several versions of your application: This can also be true for different processors in the same processor family. For example, there are several different variants of the very popular ARM chip design that require different native compilers.



Native code needs to be stress tested more than managed code.
Working in native code means managing your own memory and other resources. Experience has shown that it is very difficult if not impossible to build a "perfect application." Almost invariably, some memory or other system resource is occasionally left unreleased in complex systems. Over time even small memory or other resource leaks that occur in repetitive code can strain the finite resources on a device. Many cell phones are never turned off. Many PDAs have instant-on features that keep applications running or in memory even when the device is switched off. With respect to memory leaks, mobile devices behave more like servers than desktop applications because mobile devices are often left on continuously. If you are leaking memory, you will eventually cause the system to become unresponsive or unstable. Native code development on devices requires an extra amount of diligence and 24/7 stress testing.





C++ Tools Available for Mobile Device Development



As of this writing, Microsoft offers a free C/C++ development tool for device developers called eVC++. eVC++ stands for Embedded Visual C++. It is available for free download from Microsoft and enables developers to build native code C/C++ applications for Windows CE, Pocket PC, and the Microsoft Windows Mobile 2003 software for Smartphone (mercifully referred to hereafter simply as the Microsoft Smartphone) devices. This development environment is based on the Visual Studio 6.0 C++ development environment, which predates the Visual Studio .NET development environment. Microsoft''''''''s plan is for future versions of Visual Studio .NET (starting with the 2005 "Whidbey" release) to contain support for C++ native code development for devices, thus merging the two into one single environment.


People developing for Windows XP Embedded can use the same Visual Studio .NET development environment that exists for desktop and server development.


Many other companies also make native code development environments for devices, including MetroWorks and WindRiver. A great many command-line tools also exist, some free and some for sale. Typically these development environments are packaged per-development target; for example, a development environment for Windows CE; a different development environment for the Symbian Operating System; and a different development environment for LINUX, FreeBSD, Palm OS, and so on.


Various levels of support for the ANSI C/C++ standards exist in mobile device development tools. If code or library portability is a goal for you:



Pay special attention to the level of standards support in the compiler you choose, particularly for sophisticated features such as structured exception handling.
Different compilers will have different levels of support for things such as exception handling as well as potentially for things such as floating-point math support or the standard bit widths for integers.



Have well-defined coding guidelines that identify the compiler features and code libraries you will use in your application.
Make sure these features and libraries are supported by all the compilers you plan to use to target different processors or operating systems.



Consider using least common denominator features such as only using C (as opposed to C++) or only using a specific simple subset of C++ features.
This will help ensure that the language features you use are present and supported equally on the widest variety of compilers.



Test early and test often on each of the compilers/platforms you want to target.
Not all C/C++ compilers are created equal and some may contain bugs that you will only find when running code or debugging. In general C/C++ compilers for devices are not used as widely as desktop and server x86 compilers. The consequence of this is that they do not have as many developers exercising their code-generation capabilities. Practical experience has proven that in general less usage means more subtle bugs and limitations. If you do not test your code early and often on the set of compilers and platforms you want to run on, you are in for nasty surprises!



Understand the licensing policy restrictions of the compilers, libraries, and tools you are using.
If you are building code for commercial use, be aware of the licensing policies of the compiler, source and runtime libraries, and build tools you use. As boring as licensing agreements are to read, it is better to find out early than have to redesign or move to another compiler late in a product cycle. Switching compilers sounds easy but is remarkably difficult and time-consuming. This is true for all software development but particularly true for mobile device development because the large variety of different specialist tools that exist with different licensing policies including EULAs (end-user license agreements), royalty restrictions, intellectual property ownership restrictions such as GPL (general public license), LGPL (lesser general public license), FreeBSD, and so forth. Caveat emptor: Let the coder beware! No one is looking to pull one over on you; just make sure you choose knowingly.




Native code development for mobile devices is a viable choice and may be appropriate for your needs, but this decision needs to be made deliberately and for the right reasons. If you choose to write your mobile device application in native code, make sure you are doing so for the correct reasons and spend time up front understanding the C/C++ compiler choices you will be making along with the engineering and testing burden this will require. Native code mobile device development is significantly more complex than native code desktop or server development. To be successful, you need to approach it armed with clear goals and an understanding of the tools you will be using.


/ 159