Development Patterns and Best Practices: Page 1 of 6
Development Patterns and Best Practices: Page 1 of 6
Development Patterns and Best Practices: Page 1 of 6
___
______
___
Component Types
Every software solution contains similar kinds of components, regardless of the specific business need it addresses. For example, most applications contain components that access data, encapsulate business rules, handles user interaction and external services. Identifying the kinds of components commonly found in distributed software solutions will help you build a blueprint for an application or service design.
______
purpose.
___
Below is a diagram depicting commonly found components and a brief description of their
1 2
Business Components
5 6 8
Business Entities
Service Agents
Data Layer
Services Layer
Other External Services
Component descriptions:
1. User interface (UI) components: Most solutions need to provide a way for users to interact with the application. User interfaces are implemented using Windows Forms, Microsoft ASP.NET pages, controls, or any other technology you use to render and format data for users and to acquire and validate data coming in from them. 2. User Process Components: In many cases, a user interaction with the system follows a predictable process. For example, in a retail application you could implement a procedure for viewing product data that has a user select a category from a list of available product categories and then select an individual product to view more detail. Processes of this nature are common no matter what user interface a user may be presented. User Process Components may be viewed as business logic from a user interface perspective. In some case, authenticating the user may also occur at this level. However, authentication is usually done within the Service interface layer.
______
interfaces that support the communication contracts (message-based
___
3. Service interfaces: To expose business logic as a service, you must create service communication, formats, protocols, security, exceptions, and so on) that consumers require. Service interfaces are sometimes referred to as business facades. In addition, they provide the ability to separate layers across physical tiers. Typically, authenticating users and/or incoming services occur at this level. 4. Business workflows: After the required data is collected by a user process, the data can be used to perform a business process. Many business processes involve multiple steps that must be performed in the correct order and orchestrated. Business workflows define and coordinate long-running, multi-step business processes, and they can be implemented using business process management tools such as BizTalk Server Orchestration. 5. Business components: Regardless of whether a business process consists of a single step or an orchestrated workflow, your application will probably require components that implement business rules and perform business tasks. Business components implement the business logic of the application. 6. Business entity components: Most applications require data to be passed between components. The data is used to represent real-world business entities, such as products or orders. The business entities that are used internally in the application are usually data structures, such as DataSets, DataReaders, or Extensible Markup Language (XML) streams. 7. Data access logic components: Most applications and services will need to access a data store at some point during a business process. It makes sense to abstract the logic necessary to access data in a separate layer of data access logic components. Doing so centralizes data access functionality and makes it easier to configure and maintain. 8. Service agents: When a business component needs to use functionality provided by external service, you may need to provide some code to manage the semantics of communicating with that particular service. Service agents isolate the idiosyncrasies of calling diverse services from your application, and can provide additional services, such as basic mapping between the format of the data exposed by the service and the format your application requires. 9. Components for security, operational management and communication: Your application will probably also use components to authorize users to perform certain tasks, and to communicate with other services and applications.
______
Presentation Layers UI Process Component
___
UI Components
1
Service Interface
2
Business Component
3 3 4
Business Component
Component Interaction:
1. UI Process Components initiate a call to a Business component via the Service Interface component. Business Entities such as Datasets or XML streams, many be used to send or receive data between layers. There are however, exceptions to this rule (not shown in the diagram). There are times when read-only access to data are required, and bypass the business components and calling the data access components directly is more desirable. This aids in the efficiency and simplicity of the overall design. 2. UI Process Components as well as external services will make calls directly to the Service Interface component. Typically, Service Interface components are thin wrappers that authenticate and authorize the caller, prior to delegating the call to a Business Workflow, Business, Data Access or Service Agent component, responsible for the actual work. Service Interface components are typically designed using Web Services or .NET Remoting. 3. Data Access components are typically called by Business Workflows or Business components. Although not shown, Service Interface components may call read-only Data Access components directly, where business rules do not apply. 4. Similar to Data Access components, Service Agents are typically called by Business Workflows or Business components. Although not shown, Service Interface
______
rules do not apply.
___
components may call read-only Service Agent components directly, where business