Application Architecture Guide 2.0 - CH 19 - Mobile Applications(1)

 

Chapter 19: Mobile Applications

Objectives

Define a mobile application.

Understand components found in a mobile application.

Learn the key scenarios where mobile applications would be used.

Learn the design considerations for mobile applications.

Identify specific scenarios for mobile applications, such as deployment, power usage, and synchronization.

Learn the key patterns and technology considerations for designing mobile applications.

目标

定义一个移动应用。

理解建立在一个移动应用中的要素。

学习移动应用中的重要用户场景。

学习移动应用设计中的考虑因素

鉴别特定的移动应用场景,如部署,用电量和同步等。

学习移动应用中的关键模型和技术因素。

 

Overview

A mobile application will normally be structured as a multi-layered application consisting of user experience, business, and data layers. When developing a mobile application, you may choose to develop a thin Web-based client or a rich client. If you are building a rich client, the business and data services layers are likely to be located on the device itself. If you are building a thin client, the business and data layers will be located on the server. Figure 1 illustrates common rich client mobile application architecture with components grouped by areas of concern.

概述

通常,移动应用由一个多层的应用结构,包括用户体验、业务和数据等。在开发移动应用时,你可以选择做一个基于网络的瘦客户端或者是一个富客户端。如果选择富客户端,那么业务和数据服务层一般是位于设备本身的。如果选择瘦客户端,那么业务和数据层则是位于服务器端的。图1中,根据组成要素的关系,描述了一个富客户端的移动应用架构。

1:常用富客户端应用架构

 

Design Considerations

The following design guidelines provide information about different aspects you should consider when designing a mobile application. Follow these guidelines to ensure that your application meets your requirements and performs efficiently in scenarios common to mobile applications:

设计考虑

当设计一个移动应用时,下面的设计方针为你提供了应该考虑的不同方面的信息。遵循这些指导能够确保你的应用能够满足需求,同时,对于一般的移动应用能够有效。

 

Decide if you will build a rich client, a thin Web client, or rich Internet application (RIA). If your application requires local processing and must work in an occasionally connected scenario, consider designing a rich client. Keep in mind that a rich client application will consume more device resources and will be more complex to install and maintain. If your application can depend on server processing and will always be fully connected, consider designing a thin client. If your application requires a rich user interface (UI), only limited access to local resources, and must be portable to other platforms, design an RIA client.

决定建立一个富客户端、基于网络的瘦客户端或者是富Internet应用(RIA)。如果你的应用需要本地处理,偶尔在联网的情况下必须工作,那么就考虑设计成一个富客户端。记住,一个富客户端应用会消耗更多的设备资源,按照和维护工作也会比较负责。如果你的应用能够依靠服务器来处理,并且一直保持联网,那么就考虑设计瘦的客户端。如果你的应用需要丰富的用户体验,使用的本地资源受限,并且必须能够移植到其它平台,那么就设计成RIA客户端。

 

Determine the device types you will support. When choosing which device types to support, consider screen size, resolution (DPI), CPU performance characteristics, memory and storage space, and development tool environment availability. In addition, factor in user requirements and organizational constraints.

决定你支持的设备类型。在选择支持的设备类型时,要考虑屏幕大小、分辨率(DPI)、CPU特性、主内存大小、扩展存储大小和可用的开发工具环境。另外,还要考虑用户需求和组织限制的因素。

 

Design the application with occasionally connected limited-bandwidth scenarios in mind. Most mobile applications must work when a network connection is intermittent or not available. It is vital in this situation to design your caching, state management, and data access mechanisms with intermittent network connectivity in mind. Batch communications for times of connectivity. Choose hardware and software protocols based on speed, power consumption, and “chattiness,” and not just on ease of programming

设计偶尔联网,并且带宽受限的应用。大多数移动应用必须在间歇性地连接网络或者网络不可用的情况下都能工作。在这种间歇性的网络连接情况下,设计你的内存、状态管理和数据获取机制是很重要的。在有网络连接的情况下,就进行通信的批处理。在基于速度、功耗和“繁琐”程度上来选择硬件和软件协议,而并不是从编程的难易程度上来做。

 

Design a UI appropriate for mobile devices, taking into account platform constraints. Mobile devices require a simpler architecture, simpler UI, and other specific design decisions in order to work within the constraints imposed by the device hardware. Keep these constraints in mind and design specifically for the device instead of trying to reuse the architecture or UI from a desktop or Web application. The main constraints are memory, battery life, ability to adapt to difference screen sizes and orientations, security, and network bandwidth.

考虑平台约束的情况,设计适合移动设备的UI。移动设备需要简单的架构、简洁的UI和其它特定的设计来满足设备硬件所带来的资源受限情况。牢记这些限制来设计适合设备的程序,而非尝试着重用桌面或者网络应用的架构。最主要的限制包括内存容量、电池寿命、适应不同屏幕大小和分辨率的能力、安全和网络带宽。

 

Design a layered architecture appropriate for mobile devices that improves reuse and maintainability. Depending on the application type, multiple layers may be located on the device itself. Use the concept of layers to maximize separation of concerns, and to improve reuse and maintainability for your mobile application. However, aim to achieve the smallest footprint on the device by simplifying your design compared to a desktop or Web application.

设计分层的架构,适应移动设备,提高可重用性和可维护性。基于应用的类型,不同的层位于设备本身内部。利用层的概念来最大化地分离考虑的因素,并且提高移动应用的可重用性和可维护性。但是,和桌面或者网络应用相比,通过简化你的设计来实现这个最小的覆盖区。

 

Design considering device resource constraints such as battery life, memory size, and processor speed. Every design decision should take into account the limited CPU, memory, storage capacity, and battery life of mobile devices. Battery life is usually the most limiting factor in mobile devices. Backlighting, reading and writing to memory, wireless connections, specialized hardware, and processor speed all have an impact on the overall power usage. When the amount of memory available is low, the Microsoft® Windows Mobile® operating system may ask your application to shut down or sacrifice cached data, slowing program execution. Optimize your application to minimize its power and memory footprint while considering performance during this process.

考虑设备资源受限的因素,如电池寿命、内存大小和处理器速度等。每个设计应该考虑移动设备的CPU受限、内存/存储容量和电池寿命。一般来说,电池寿命是移动设备上最受限的因素。背景灯、读写内存、无线连接、特殊的硬件和处理器速度,所有这些会对总体功耗产生重要的影响。在可用内存很少的情况下,Microsoft® Windows Mobile®操作系统会提醒你关闭应用程序或者丢失缓存的数据、降低程序执行速度等等。在考虑性能表现的情况下,优化你的应用程序,将功耗和内存使用降到最小。

 

Mobile Client Frame

There are several common issues that you must consider as your develop your design. These issues can be categorized into specific areas of the design. The following table lists the common issues for each category where mistakes are most often made.

移动客户端框架

在开发应用程序的时候,有一些问题是你必须要考虑的。这些问题可以分成不同的类型。下面的表格列出了通常容易出错的问题。

 

1 移动客户端框架

类型

主要问题

认证和授权

l  在偶尔连接网络的情况下,未使用认证。

l  在偶尔连接网络的情况下,未使用授权。

l  VPN网络下,未使用认证和授权。

l  使用空中接口同步时,未使用认证。

l  与主机同步时,未使用认证。

l  在有连接的情况下,比如空中接口、插座、蓝牙和SD卡,未使用认证。

l  不能辨别不同设备之间的安全模式差异。

缓存

l  在资源受限的设备上缓存不必要的数据。

l  在间歇性网络连接的情况下,依靠可能无法获得的缓存数据。

l  选择不合理的缓存地址和数据格式

l  使用未加密的格式来存放敏感数据

l  未使用合适的缓存技术

通信

l  未能保护空中接口的敏感数据。

l  未对网络服务通信进行加密。

l  未对VPN通信进行加密。

l  在带宽受限网络连接下,未对通信进行加密。

l  未对受限带宽连接进行有效管理。

l  未对多个网络服务进行有效管理。

l  未考虑在间歇性网络连接的情况下工作。

l  未考虑连接成本,并让用户来管理连接。

l  在使用电池的情况下,未考虑最小化功耗。

l  未使用合适的通信协议。

配置管理

l  设备重启后,未恢复配置状态。

l  未考虑通过空中接口进行配置管理同步。

l  未考虑通过主机进行配置管理同步。

l  采用不合适的数据格式来存储配置信息。

l  未保护敏感配置信息。

l  未考虑不同设备制造商对于重载配置参数的差异。

数据获取

l  未考虑间歇性网络连接的数据获取机制。

l  未考虑数据库接入的性能。

l  在很大的dataset中进行查询。

l  未考虑合适的复制方法和技术。

l  未考虑使用设备数据库服务,如Microsoft SQL Server® Compact Edition

调试

l  在选择支持多种设备的时候,未考虑调试成本。

l  在设计时,未考虑调试,例如,使用模拟器而不是真实设备。

l  未考虑所有连接情况下的调试。

设备

l  未考虑设备的差异性,如屏幕大小和CPU能力。

l  给用户展示不友好的出错信息。

l  未保护敏感信息。

l  未考虑设备的处理能力。

异常管理

l  抛出异常以后,未恢复应用程序状态。

l  暴露敏感信息给用户。

l  未记录详尽的异常信息。

l  使用异常来控制应用流程。

日志

l  未考虑远端的日志记录,而只考虑设备。

l  未考虑如何获取设备日志。

l  未考虑记录日志时,资源受限的情况。

l  未保护日志文件中的敏感信息。

移植

l  未重写现存的富客户端UI来适合设备。

l  未探究可用的移植工具。

同步

l  在通信过程中,未对同步进行安全保护。

l  未管理空中接口的同步,而不是插座同步。

l  未管理同步中断。

l  未处理同步冲突。

l  未考虑合适的合并复制。

用户界面

l  未考虑受限的UI因素。

l  未考虑单窗口环境。

l  未考虑单用户程序运行情况。

l  未设计可用的触摸屏或者触笔UI

l  未包含对不同屏幕大小和方向的支持。

l  未管理设备重启和恢复。

l  与桌面应用相比,未考虑受限的APIUI控件。

验证

l  和主机通信过程中,未对输入和数据进行验证。

l  在空中接口通信过程中,未对输入和数据进行验证。

l  未保护硬件资源,例如摄像头和电话的初始化。

l  在设计时,未考虑受限的资源和性能。

 

posted on 2009-01-12 16:48  施炯  阅读(2796)  评论(4编辑  收藏  举报