Application Architecture Guide 2.0 - CH 19 - Mobile Applications(5)
本文翻译"Deployment"、"Pattern Map"、"Pattern Descriptions"和"Technology Considerations"中的"Microsoft Silverlight for Mobile"部分。
Deployment
Mobile applications can be deployed using many different methods. Consider the requirements of your users, as well as how you will manage the application, when designing for deployment. Ensure that you design to allow for the appropriate management, administration, and security for application deployment.
Deployment scenarios listed for Windows Mobile device applications, with the more common ones listed first, are:
• Microsoft Exchange ActiveSync® using a Windows Installer file (MSI).
• Over the air, using HTTP, SMS, or CAB files to provide install and run functionality.
• Mobile Device Manager–based, using Active Directory to load from a CAB or MSI file.
• Post load and auto-run, which loads a company-specific package as part of the operating system.
• Site loading, manually using an SD card.
部署
移动应用程序可以通过很多不同的方法来部署。设计部署方案时,要兼顾用户需求和你自身应用程序的管理。确保你的设计能够进行适当的管理和监督,并进行安全地部署。
Windows Mobile设备应用部署场景如下:
•通过Microsoft Exchange ActiveSync®,使用Windows Installer文件。
•通过空中接口,使用HTTP,SMS,或者是CAB文件来提供安装并运行功能。
•基于Mobile Device Manager,使用Active Directory来从CAB或者MSI文件加载。
•启动时自动加载并自动运行,加载一个公司定制的包作为操作系统的一部分。
•定点加载,手动使用SD卡。
Consider the following guidelines when designing your deployment strategy:
• If your users must be able to install and update applications while away from the office, consider designing for over-the-air deployment.
• If you are using CAB file distribution for multiple devices, include multiple device executables in the CAB file. Have the device detect which executable to install, and discard the rest.
• If your application relies heavily on a host PC, consider using ActiveSync to deploy your application.
• If you are deploying a baseline experience running on top of Windows Mobile, considering using the post-load mechanism to automatically load your application immediately after the Windows Mobile operating system starts up.
• If your application will be run only at a specific site, and you want to manually control distribution, consider deployment using an SD memory card.
在设计部署策略时,考虑以下指导方针:
•如果用户需要在离开办公室的情况下,安装并升级软件,那么就考虑使用空中接口来部署。
•如果你要使用CAB文件发布给多个设备,那么就在CAB文件中包含多个设备的可执行文件。让设备来检测安装哪个可执行文件,并丢弃其他的文件。
•如果你的应用经常依靠主机,那么考虑使用ActiveSync来部署应用。
•如果你要部署一个运行于Windows Mobile设备上的基本的体验,那么考虑使用开机重启加载的机制,在Windows Mobile操作系统运行后,来自动加载你的应用程序。
•如果你的应用程序只能运行于一个特定的位置,并且你想要手动控制分发,那么就考虑使用SD卡来部署。
Pattern Map
Table 2 Pattern Map
模式图
表2 模式图
类别 |
相关模式 |
缓存 |
惰性采集 |
通信 |
•活动对象 •通信器 •实体翻译 •可靠的会话 |
数据获取 |
•活动记录 •数据传送对象 •域模型 •执行脚本 |
同步 |
同步 |
UI |
•应用控制器 •模型浏览控制器 •模型浏览呈现者 •分页 |
Pattern Descriptions
• Active Object. Support asynchronous processing by encapsulating the service request and service completion response.
• Active Record. Include a data access object within a domain entity.
• Application Controller. An object that contains all of the flow logic, and is used by other Controllers that work with a Model and display the appropriate View.
• Communicator. Encapsulate the internal details of communication in a separate component that can communicate through different channels.
• Data Transfer Object (DTO). An object that stores the data transported between processes, reducing the number of method calls required.
• Domain Model. A set of business objects that represents the entities in a domain and the relationships between them.
• Entity Translator. An object that transforms message data types into business types for requests, and reverses the transformation for responses.
• Lazy Acquisition. Defer the acquisition of resources as long as possible to optimize device resource use.
• Model-View-Controller. Separate the UI code into three separate units: Model (data), View (interface), and Presenter (processing logic), with a focus on the View. Two variations on this pattern include Passive View and Supervising Controller, which define how the View interacts with the Model.
• Model-View-Presenter. Separate request processing into three separate roles, with the View being responsible for handling user input and passing control to a Presenter object.
• Pagination. Separate large amounts of content into individual pages to optimize system resources and minimize use of screen space.
• Reliable Sessions. End-to-end reliable transfer of messages between a source and a destination, regardless of the number or type of intermediaries that separate the endpoints
• Synchronization. A component installed on a device tracks changes to data and exchanges information with a component on the server when a connection is available.
• Transaction Script. Organize the business logic for each transaction in a single procedure, making calls directly to the database or through a thin database wrapper.
模式描述
•活动对象。通过封装服务请求和服务完成相应,支持异步处理操作。
•活动记录。包括在一个域实体中的数据访问对象。
•应用控制器。一个包含了所有流程逻辑的对象,被其他控制器用来与一个Model合作并显示合适的View。
•通信器。将通信的内部具体信息封装在一个分离的元件中,使他可以通过不同的通道来通信。
•数据传送对象(DTO)。该对象存储了不同处理操作间的传送数据,以减少调用方法的次数。
•域模型。一个业务对象的集合,代表着域中的实体和他们之间的关系。
•实体翻译。该对象将消息数据类型翻译成需要的业务类型,并将相应翻译为消息数据类型。
•惰性采集。尽可能推迟资源的获取,来优化设备资源的使用。
•模型浏览控制器。将UI的代码分为三个部分:模型(数据),浏览(接口),以及呈现(处理逻辑),主要关心浏览部分。该模式下的两个不同就是被动的浏览和监视控制器,它定义了浏览如何与模型进行交互。
•模型浏览呈现者。将请求处理分为三种不同的部分,处理用户输入的浏览响应,并将控制信息传递给呈现对象。
•分页。将大量的内容分成单独的页来优化系统资源并最小化屏幕的使用。
•可靠的会话。指源节点和目的节点之间端对端可靠的消息传输,并不考虑分割他们的中间节点类型和数量。
•同步。一个安装在设备上的元件,跟踪记录数据的变化,并在连接可用时,记录与服务器之间的信息交换。
•执行脚本。组织单个程序中执行每个命令的业务逻辑,直接通过数据库或者瘦数据库封装进行调用。
Technology Considerations
The following guidelines contain suggestions and advice for common scenarios for mobile applications and technologies.
技术考虑
以下指导方针包含了对于移动应用和技术通用场景的意见和建议。
Microsoft Silverlight for Mobile
If you are using Microsoft Silverlight® for Mobile, consider the following guidelines:
• Consider that at the time of this writing, Silverlight for Mobile was an announced product under development, but not yet released.
• If you want to build applications that support rich media and interactivity and have the ability to run on both a mobile device and desktop as is, consider using Silverlight for Mobile. Silverlight 2.0 code created to run on the desktop in the Silverlight 2.0 plug-in will run in the Windows Mobile Silverlight plug-in in the latest version of Microsoft Internet Explorer for Mobile. Consider that while it is possible to use the same Silverlight code in both places, you should take into account the differing screen size and resource constraints on a mobile device. Consider optimizing the code for Windows Mobile.
• If you want to develop Web pages for both desktop and mobile platforms, consider Silverlight for Mobile or normal ASP.NET/HMTL over ASP.NET for Mobile unless you know that your device cannot support either of these alternatives. As devices browsers have become more powerful, they are able to process the same native HTML and ASP.NET targeted by the desktop, thus making ASP.NET Mobile development less important. ASP.NET Mobile Controls currently supports a variety of mobile devices through specific markup adapters and device profiles. While ASP.NET Mobile Controls automatically render content to match device capabilities at run time, there is overhead associated with testing and maintaining the device profiles. Development support for these controls is included in Microsoft Visual Studio 2003 and 2005 but is no longer supported in Visual Studio 2008. Run-time support is currently still available, but may be discontinued in the future. For more information, see the links available in the Additional Resources section.
如果你要使用Microsoft Silverlight® for Mobile,那么考虑如下指导方针:
•在当前,Silverlight for Mobile只是作为一个处于开发中的产品,并未正式发布。
•如果你要建立支持丰富多媒体的应用,并且在移动设备和桌面设备上都能运行,那么就考虑使用Silverlight for Mobile。用Silverlight 2.0创建的代码能够在装有Silverlight 2.0 plug-in的桌面机上运行,同时也能够在装有包含Silverlight plug-in的最新版本的Microsoft Internet Explorer for Mobile的Windows Mobile设备上运行。在这两种不同的场合使用相通的代码时,要考虑移动设备上的多种屏幕大小和资源限制。考虑为Windows Mobile进行代码优化。
•如果你想为桌面平台和移动平台同时开发Web页面的话,那么考虑使用Silverlight for Mobile或者基于ASP.NET for Mobile之上的标准ASP.NET/HMTL,除非你知道你的设备不能支持上面两种选择中的任何一个。由于设备浏览器变得越来越强大,与桌面应用一样,他们能够处理相同的本地HTML和ASP.NET,因此使得ASP.NET Mobile开发变得越来越不重要。当前的ASP.NET Mobile控件支持很多移动设备,包括具有特殊标记适配器和设备信息的。ASP.NET Mobile控件具有在运行时能够将内容转化为设备匹配的信息的能力,而在测试以及维护设备信息时,会有一定的开销。对这些控件进行开发在Microsoft Visual Studio 2003和2005中是支持的,但是在Visual Studio 2008是不支持的。对于运行时的支持,当前仍然可用。但是将来可能变得不可用。更多信息请参考Additional Resources这一节给出的链接。