天天看點

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這一節給出的連結。