Application Architecture Guide 2.0 学习笔记(一)前言 - Application Types

来源:互联网 发布:网络水军公司如盛 编辑:程序博客网 时间:2024/05/10 15:50

Application Types (应用程序类型)

The following guidelines will help you to understand the fundamental factors you must consider when choosing an application type(下列指导将有助于理解选择应用程序类型的基本因素). Use these guidelines as a starting point toward understanding how to choose an application type, and the key differences between each application type covered in this guide. For example, device resources and performance are key considerations when designing a mobile application(例如:设备资源与性能是设计移动应用是的关键考虑因素); choice of UI design patterns is a key consideration when designing a rich client application(UI设计的选择是设计富客户端应用关键考虑因素); and changes to your UI design and deployment paradigms are key considerations when designing a rich Internet application (设计RIA应用最关键的考虑是UI设计的变化与部署形式). Key considerations when designing a service interface include choosing a pattern for effective decoupling(在设计服务接口的时候,最关键的考虑是选择一种有效的解耦模式). Key considerations when designing a Web application include layering, as well as the amount of client-side processing to use(在设计Web应用程序时最关键的考虑包括分层以及使用多少客户端处理).


• How to choose an application type(如何选择应用程序类型)


Your choice of application type will be driven primarily by the scenarios that you want to support(对于应用程序的选择主要受需要支持的应用场景所驱动). If you want to leverage client resources and support disconnected scenarios, consider a rich client application(如果想要平衡客户端资源并支持分离的场景,考虑富客户端应用). If you want to provide the application UI over the Web, consider building a Web application(如果想要基于Web提供UI,考虑使用Web应用). If you want to support advanced graphics and streaming media in a Web-deployed scenario, consider a rich Internet application (RIA)(如果想要支持高级图形与流媒体场景,考虑RIA应用). If you want to expose a loosely coupled interface to remove clients without a UI, consider building a service(如果想要公开一个松耦合的接口,移除带UI的客户端,考虑构建一个服务). If you want to support mobile devices over the Internet, consider designing a mobile Web application(如果在互联网上支持移动设备,考虑设计一个移动Web应用). If you want to support mobile devices in which you leverage device resources or need to support partially disconnected scenarios, consider a mobile rich-client application(移动富客户端).


For more information, see Chapter 14, “Application Archetypes.”


• How to design a Web application(如何设计Web应用程序)


Most of the code associated with a Web application resides on a Web server(大多数Web应用的代码都在服务器端), with some code implemented in the client browser(也有一些代码在客户端实现). The design you use on the Web server can vary, based on the type and size of the application you are building(基于应用的类型与规模,Web服务器上的设计也不同). For smaller applications with few or no business rules, a client/server design can be used where presentation code that generates HTML interacts directly with data-access components(对于小型的应用,没有业务规则,可以使用C/S设计,生成HTML代码的表示层直接与数据访问组建交互). For most business applications, or larger applications that contain business rules, consider using a layered  design that separates presentation, business, and data-access functionality into separate layers(对于大多数商业应用或者大型应用,它们包含业务规则,考虑使用分层设计来将表示、业务与数据访问功能分成分开的层次). In  ddition, the interaction between the presentation and business layers should be message-based(另外,表示层与业务层之间的交互最好是基于消息的), which is better suited to the stateless nature of Web application requests(这样就更适合Web程序天生的无状态特性). On the client, you can improve the user experience by using dynamic HTML (DHTML), JavaScript, Asynchronous JavaScript and XML (AJAX), or a combination of all three technologies(在客户端,可以使用动态HTML,Javascript,AJAX技术来提升用户体验). For example, with AJAX you can implement lazy loading and partial updates to page content, which will improve performance and prevent the “reload flash” when a user interacts with the page(例如,使用AJAX可以实现页面内容的延迟载入和局部更新,这样可以提高性能并防止“reload flash”).

 

For more information, see Chapter 15, “Web Applications.”


• How to design a rich client application(如何设计富客户端)


For reusability and testability(重用、可测试), separate the presentation logic from the UI implementation by using a design patterns such as Model-View-Controller (MVC)(为了重用性与可测试能力,使用像MVC这样的设计模式将表示逻辑与UI实现分开). Design to provide a suitable and usable interface in terms of layout, navigation, choice of controls, and localization(依据布局、导航、空间的选择与本地化要求,设计一套合适切可用的接口). Extract business rules and other tasks not related to the UI into a separate business layer(将业务规则与其他与UI不相关的任务提取到业务层). Use a message-based interface to communicate with services  eployed on separate physical tiers(使用基于消息的接口与物理上分离的服务通信). Avoid tight coupling to objects in other layers by using common interface definitions, abstract base classes, or message-based communication(为避免与其他层对象的紧耦合,使用通用的接口定义、抽象基类或者基于消息的通信). For example, implementing the  Dependency Injection and Inversion of Control patterns can provide a shared abstraction between layers.(例如:实现依赖注入和控制反转可以为借口之间提供一个共享的抽象)


For more information, see Chapter 17, “Rich Client Applications.”


• How to design a rich Internet application (RIA)(如何建立RIA应用)


Plan to use a Web-based infrastructure, because RIA implementations require an infrastructure similar to that of Web applications(因为RIA实现需要一个与Web应用类似的基础设施,所有计划使用基于Web的基础设施). Design your application to run in the browser sandbox(设计你的应用在浏览器沙盒中运行). When designing an RIA, consider using a single page that changes dynamically as the user works with the application(在设计RIA是,考虑使用单一的页面,它会在用户使用这个应用的时候动态改变). Multi-page designs are more complex in an RIA(多页设计在RIA应用中会更复杂), and require additional considerations such as deep linking and UI screen navigation(需要一些额外的考虑,例如很深的链接与UI屏幕导航). Design for usability, such as the ability to pause and navigate to the appropriate point in a workflow without restarting the whole process(为可用性设计,例如暂停的能力以及不重新开始就可以导航到一个流程的适当位置的能力). RIA implementations have a small footprint on the client, but require a browser plug-in(RIA实现需要客户端安装一个浏览器插件). Design for scenarios in which the browser plugin is not already installed, including non-interruptive plug-in installation and displaying informative error messages if an installation problem should occur(要考虑到如果浏览器没有安装插件的情景).


For more information, see Chapter 16, “Rich Internet Applications.”


• How to design a service(如何设计服务)


When designing a service, there are general guidelines that should be followed; for example, design for extensibility(为扩展性设计), use coarse-grained interfaces(使用粗粒度接口), never assume how the client will use the service(永远不要假设客户端怎么使用服务), and decouple the interface from the implementation(将接口与实现解耦). The best way to support these guidelines is to introduce a service layer in your design that sits between consumers of the service and the business layer that supports the service(支持这些知道最好的方法就是在业务层与使用这些业务层的消费者之间引入服务层). Within the service layer, you define interface contracts, classes to translate between the interface and the business layer, and concrete classes that implement the interface(在服务层中,定义接口协定、在接口与业务层之间转换的类、实现接口的具体类). In most cases, interaction with the business layer is accomplished by using a Façade pattern, which allows you to combine multiple business operations into a single application-scoped service operation(在大多数情况下,与业务层的交互使用外观模式来实现,这样允许你将多个业务操作合并成一个单一的应用程序范围的服务操作).


For more information, see Chapter 18, “Services.”


• How to design a mobile application(如何设计移动应用)


Design specifically for the device instead of trying to reuse the architecture or UI from a desktop application or a Web application(为移动设备做特殊设计,而不是尝试重用桌面应用或Web应用的UI架构). When choosing which device types to support, consider screen size and format, CPU performance characteristics, memory and storage space, development tool and environment support, as well as user requirements and organizational constraints(在选择要支持什么型号的设备时,除考虑用户需求与组织约束之外,还要考虑屏幕大小与格式、CPu性能特征、内存与存储空间、开发工具与支撑环境). Design your caching, state management, and data-access mechanisms with intermittent network connectivity in mind(设计缓存、状态管理与数据访问机制要记得 断续的网络连接??) 。

 

For more information, see Chapter 19, “Mobile Applications.”

原创粉丝点击