Three-layered services application (layer-3 Service Application)

Source: Internet
Author: User
Tags net xml biztalk
Document directory
  • Presentation Layer
  • Business Layer
  • Data Layer
  • Basic services

Context

You are designingLayered Application. You want to make public some of the core functions of your application as a service that other applications can use, and want your application to use the services that other applications expose.

 

Problem

How do I layer service-oriented applications and then determine components in each layer?

 

Influencing Factors

BesidesLayered ApplicationThe following factors should also be taken into account:

You always want to minimize the impact of adding services to existing applications.

Services are usually exposed to clients other than the company's firewall, so they have different security and operational requirements from business components.

Communication with other services requires a lot of knowledge about protocols and data formats.

You want to separate the concerns in different components so that you can change the components for only one reason, for example, separating the business logic from the technology required to access external services.

 

Solution

Build a layered architecture on the basis of three layers: representation, business, and data. This mode outlines the responsibilities of each layer and the components that constitute each layer. For more information, see the article "application architecture for. Net: designing applications and services." [pnp02].

TheThree-layered Services ApplicationIt is basically a loose three-tier architecture. The three layers are:

.The presentation layer provides the user interface (UI) of the application ). This usually includes the use of Windows Forms (for Smart Client Applications) and ASP. NET technology (for browser-based interaction.

Business.The business layer implements the business functions of applications. The domain layer is usually composed of a large number of components implemented using one or more programming languages that support. net. These components may be Microsoft & reg; for Scalable Distributed Component solutions ;.. NET Enterprise Services, or Microsoft BizTalk & reg; server for workflow orchestration.

Data.The data layer provides access to external systems (such as databases. The main. NET technology involved in this layer is ADO. net. However, some. Net XML functions are also frequently used here.

Each layer should be constructed as described in the following sections.

Presentation Layer

Most business applications use forms to construct the presentation layer. An application consists of a series of forms (pages) that users interact. Each form contains many fields used to display lower-layer output and collect user input.

The following two components are used to implement a form-based user interface:

User Interface Components

User Interface processing component

User Interface Components

For rich client applications, this mode uses the UI components in the. NET Framework system. Windows. Forms namespace. For Web applications, this mode uses ASP. NET components. If the standard. NET component cannot meet your needs,. Net also supports sub-classification of the standard UI component and supports inserting your own custom component into the framework.

User Interface processing component

Complex user interfaces usually require many complicated forms. To increase reusability, maintainability, and scalability, you can create a separate user interface processing (UIP) component to encapsulate the dependencies between forms and the logic of Navigation Association between forms. Some of these concepts apply to dependencies, verification, and navigation between components of a form. These UIP components are generally custom components based on design patterns such as front controller, application controller [fowler03], and mediator [gamma95.

The interaction between the UI and UIP components usually followsModel-View-ControllerOr presentation-extract action-controller [buschmann96] mode.

Business Layer

Large enterprise applications are generally constructed around the concept of business processes and business components. These concepts are handled by a large number of components, entities, proxies, and interfaces in the business layer.

Business Components

InBusiness Component FactoryPeter herzum and Oliver Sims define business components as follows:

Software Implementation of autonomous business concepts or business processes. It contains all software products necessary to represent, implement, and deploy a specified business concept as an autonomous and reusable element of a large-scale distributed information system. [Herzum00]

Business components are software implementations of business concepts. In the lifecycle of business applications, they are the main unit of design, implementation, deployment, maintenance and management. Business Components encapsulate business logic (also known as business rules ). These rules constrain the behaviors of business concepts to match the needs of specific companies. For example, business rules that determine whether a specified customer is authorized to perform a lending activity can be encapsulated in customer business components of a small solution. For large-scale solutions, all business logic related to lending may be encapsulated in a separate lending component.

Note:Three-layered services application is different from herzum and Oliver in that business flow components form their own class: business flow components.

Business workflow

Business processes reflect macro-level activities of business execution, such as order processing, customer support, and raw material procurement. These business flows are encapsulated by business workflow components that orchestrate one or more business components to implement business flows. For example, the processorder business workflow component can interact with the customer, order, and fulfillment business components to execute the "processing orders" business process. You can use any. NET language to develop custom business workflow components. Alternatively, you can use BizTalk Server to define business processes and automatically orchestrate business components.

Business Entity

A business entity is a data container. They encapsulate and hide details of specific data representation formats. For example, a business entity may initially encapsulate the set of records obtained from a relational database. Then, you can modify the business entity to minimize the impact on the remaining part of the application when writing XML documents.

Business and business workflow components can interact with independent business entity components, or use business entities to set their own statuses, and then discard the business entity. Business entities are usually used as data transfer objects [fowler03]. Data Access Components usually return business entities, rather than database-specific structures. This helps isolate database-specific details from the data layer.

Service Interface

Applications can publish some of their functions as services that other applications can use. The service interface presents the service to the external world. Ideally, it hides Implementation Details and only exposes coarse-grained business interfaces. Service interfaces are generally implemented using XML Web Service.

If you are using a domain model, classes in your domain model are generally implemented by one or more domain layer components.

Data Layer

Most business applications must access data stored in corporate databases (relational databases. The data access component in this data layer exposes data stored in these databases to the business layer.

Data Access Component

The Data Access Component isolates the business layer from the details of specific data storage solutions. This isolation has the following advantages:

Minimize the impact of changes to the database provider.

Minimize the impact of changes to the data representation (for example, changes to the database architecture.

Encapsulate all code for a specific data item at a single position. This greatly simplifies the testing and maintenance processes.

Ado. Net can be directly used as a data access component for simple applications. Using ADO. Net to develop a group of classes used to manage object-link ing complexity is of great benefit to more complex applications.

Service Gateway

Business components usually have to access internal and external services or applications. A service gateway is a component that encapsulates the interfaces, protocols, and Code necessary to use such services. For example, a business solution usually requires information in the accounting system to complete the business process. The solution delegates all interactions with the accounting system to the service gateway. The Service Gateway makes it easier to change the external service provider. Service gateways can even simulate external services to make testing at the domain layer easier.

Basic services

In addition to three standard layers, three-layered services application also defines a set of basic services that can be used by all layers. These services are divided into three basic categories:

Security.These services maintain application security.

Run management.These service management components and associated resources meet the operation requirements such as scalability and fault tolerance.

Communication.These are services that provide communication between components, such as. Net remoting, soap, and asynchronous message transmission.

 

Result Context

UseThree-layered Services ApplicationModes have the following advantages and disadvantages:

Advantages

The three layers specified in this mode are a good starting point for you to design your own solutions. You are inheritingLayered ApplicationWhile most of the advantages of the model, it can also minimize the negative effects that must be crossed over multiple layers.

Disadvantages

For complex solutions, it may be necessary to further divide the domain layer, especially when reusability has a high priority, or when designing a series of solutions based on commonly used group parts. In this case, the following three layers are usually used to replace a business layer described in this mode (for more information, see larman02 ):

Application.The application layer contains business components that are unique to the application.

Domain.The domain layer contains common business components in the business domain. For example, components related to insurance, energy, or banking.

Service.The business service layer contains business components that provide common business functions (such as finance, product, and order functions.

A single user interface layer may not provide enough solutions to provide complex user interfaces. For example, data verification, command processing, printing, and undo/repeat functions may require other layers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.