Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 48 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
48
Dung lượng
873,97 KB
Nội dung
Contents Overview 1 Introduction to theFacadeLayer 2 Technologies 6 Demonstration: Declarative Security 13 Logical Design of theFacadeLayer 23 Physical Design of theFacadeLayer 26 Market Purchasing 34 Best Practices 37 Lab 5:TheFacadeLayer 38 Review 42 Module5:TheFacadeLayer Information in this document is subject to change without notice. The names of companies, products, people, characters, and/or data mentioned herein are fictitious and are in no way intended to represent any real individual, company, product, or event, unless otherwise noted. Complying with all applicable copyright laws is the responsibility of the user. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Microsoft Corporation. If, however, your only means of access is electronic, permission to print one copy is hereby granted. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. 2000 Microsoft Corporation. All rights reserved. Microsoft, Active Directory, ActiveX, BackOffice, FrontPage, Microsoft Press, MSDN, MS-DOS, PowerPoint, Visio, Visual Basic, Visual C++, Visual InterDev, Visual J++, Visual Studio, Win32, Windows, and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners. Program Managers: Rhy Mednick, Susie Parrent Instructional Designer: Susie Parrent Subject Matter Experts: David Chesnut, Sam Gill (TechnoWiz), Michel Pahud Media Management: David Mahlmann Editing Manager: Lynette Skinner Editor: Mick Alberts, Jennifer Linn Production Manager: Miracle Davis Print Coordinators: Linda Lu Cannon (Write Stuff), Marlene Lambert (Online Training Solutions, Inc.) Build Coordinator: Eric Wagoner Graphic Artist: Scott Serna Test Lead: Eric Myers Manufacturing Manager: John Williams Group Product Manager: Juan Fernando Rivera Lead Product Manager, System Services and Infrastructure: Edward Dudenhoefer Manufacturing Manager: Rick Terek Operations Coordinator: John Williams Manufacturing Support: Laura King; Kathy Hershey Lead Product Manager, Release Management: Bo Galford Group Manager, Courseware Infrastructure: David Bramble General Manager: Robert Stewart Module5:TheFacadeLayer iii Instructor Notes This module provides students with an introduction to thefacade layer. Thefacadelayer provides a unified interface to a set of interfaces in the business logic layer and the data access layer (DAL). This module presents the two types of facade layers: the Web services facadelayer and the business facade layer. After completing this module, students will be able to: ! Describe the differences between the two types of facade layers: the Web services facadelayer and the business facade layer. ! Describe the role of thefacade layers and how to apply design patterns. ! Describe the techniques for securing a facade layer. ! Describe the design of robust COM+ components. ! Create the logical and physical designs for facade layers. ! Describe the logical and physical designs for the Market Purchasing facade layer. Materials and Preparation This section provides the materials and preparation tasks that you need to teach this module. Required Materials To teach this module, you need the following materials: ! Microsoft ® PowerPoint ® file 1910A_05.ppt ! Module5:TheFacadeLayer ! Lab 5:TheFacadeLayer Preparation Tasks To prepare for this module, you should: ! Read all of the materials for this module. ! Complete the lab. Presentation: 75 Minutes Lab: 60 Minutes iv Module5:TheFacadeLayerModule Strategy Use the following strategy to present this module: ! Introduction to theFacadeLayerThe purpose of this section is to introduce students to thefacade layer. Thefacadelayer provides a unified interface to a set of interfaces in the business logic layer and the DAL. This module presents the two types of facade layers: the Web services facadelayer and the business facade layer. In the topic “The Business Problem,” emphasize that the key functions of a facadelayer are to act as a logical buffer between user services and the underlying application architecture (business logic and DAL), to act as a security buffer for the underlying application components, and to maintain the robustness of the application. Students might have questions about how the Web services facade relates to Web services. It is important not to confuse the Web services facade with Web services. The Web services facade simplifies an interface for accessing business logic in the system. It does not, by itself, expose functionality and features over the Internet (which is what Web services does). For more information about Web services and .NET, go to http://www.microsoft.com/net/ ! Technologies The purpose of this section is to introduce students to two issues that are important for the facade: security and robustness. This is primarily a review of security. For further information about COM+ security, refer to Module 8, “Making Applications Secure,” in Course 1907A: Building Distributed Applications for Microsoft Windows 2000 with Visual Basic. Robustness is discussed in detail. The topics in this section describe techniques for handling errors in COM+ applications, features in COM+ that affect failure behavior, and suggestions for diagnosing COM+ errors. The topic “Strategies for Handling Errors in COM+” lists and describes basic guidelines for handling errors in COM+, including when to use HRESULTs and ErrorInfo objects. The topic “How COM+ Modifies Return Values” identifies the single condition under which COM+ converts a standard HRESULT to a COM+ error code before passing it back to the caller. The topic “Fault Isolation and Failfast Policy” presents how fault isolation and failfast policy affect COM+ behavior. The topic “Finding the Source of an Error” describes how you can diagnose the source of an application error and obtain a description of the error by using a combination of Microsoft Windows ® 2000, COM+, and other tools. The topic “Interpreting Error Codes” identifies the predominant error- handling mechanism for C++ and Microsoft Visual Basic ® . ! Logical Design of theFacadeLayerThe purpose of this section is to introduce students to the logical design considerations that apply to a Web services facadelayer and to a business facade layer. Module5:TheFacadeLayer v ! Physical Design of theFacadeLayerThe purpose of this section is to introduce students to the physical design considerations that apply to a Web services facadelayer and to a business facade layer. Securing a distributed application is a primary function of thefacade layer. It involves protecting the software and application content from unauthorized use yet making it available to authorized users. The most problematic part of writing components is incorporating robustness to handle possible errors. Trying to determine what can go wrong and how to address these errors can be challenging under the best conditions. Thefacadelayer is where error handling becomes an issue. An error that originates in the database bubbles up through the DAL and business logic layer to thefacade layer. Thefacadelayer is responsible for converting errors into a readable format that the user services can handle. ! Market Purchasing The purpose of this section is to discuss the logical and physical designs of Market Purchasing and to explain the justification for the choices made. The logical design of facade classes is based on the user services. The physical design implements security and robustness. You can present the implementation of the Market Purchasing facadelayer by running Component Services and presenting the Market Purchasing Web Facade COM+ application and the Market Purchasing Business Facade COM+ application. To show how thefacade separates user services from business logic, you can present the source code for the CreateRequisition method in mpfcdweb.Requisition. When user services creates a requisition, it does not actually have all of the information from the user yet. It first creates a default requisition and displays default values. Then the user can change those values and save or submit the requisition. The CreateRequisition method coordinates this by retrieving the default values by using the nontransactional DAL and returning the values through out parameters. This is an example of functionality you would not want to place in business logic. Also, you probably should not implement it in user services because this implementation would make user services more complicated. ! Best Practices The main message in the best practices for a logical design is that a facade is needed. The main message for the physical design is that an application requires security and error handling plans. vi Module5:TheFacadeLayer Lab Strategy ! Lab 5:TheFacadeLayerThe purpose of Lab 5 is for students to learn to design a facade layer. Students probably will not derive answers that correspond exactly to the design of Market Purchasing. This is acceptable as long as the student answers are justified and reflect the principles discussed in the module. Discuss with students their answers to Lab 5. Module5:TheFacadeLayer 1 # ## # Overview ! Introduction to theFacadeLayer ! Technologies ! Logical Design of theFacadeLayer ! Physical Design of theFacadeLayer ! Market Purchasing ! Best Practices This module will introduce thefacade layer. Thefacadelayer provides a unified interface to a set of interfaces in the business logic layer and the data access layer (DAL). This module presents the two types of facade layers: the Web services facadelayer and the business facade layer. After completing this module, you will be able to: ! Describe the differences between the two types of facade layers: the Web services facadelayer and the business facade layer. ! Describe the role of thefacade layers and how to apply design patterns when designing facade layers. ! Describe the techniques for securing a facade layer. ! Describe the design of robust COM+ components. ! Create the logical and physical designs for facade layers. ! Describe the logical and physical designs for the Market Purchasing facade layer. Topic Objective To provide an overview of themodule topics and objectives. Lead-in In this module, you will learn about thefacade layer, which consists of the Web services facade and the business facade, and about how to create a logical design and a physical design for a facade layer. 2 Module5:TheFacadeLayer # ## # Introduction to theFacadeLayer ! The Business Problem ! Business Requirements A facadelayer provides a unified interface to a set of interfaces in the business logic layer. In this section, the two types of facade layers are presented: the Web services facadelayer and the business facade layer. The distinction is made primarily because of the two different kinds of functionality that can be exposed. In this section, thefacadelayer will be placed in the proper context of the business problem. After this discussion, you will learn about the business services interface, and specifically about the differences between a Web services facade and a business facade. Finally, you will learn about the logical and physical designs of a facade layer. The focus of this final topic will be on both design patterns and technology. Topic Objective To provide an overview of the section topics and objectives. Lead-in In this section, you will learn about the business problem facing designers who need to implement user services and about the business requirements for a facade. Module5:TheFacadeLayer 3 The Business Problem DAL Disconnected Business Logic Layer Connected Business Logic LayerFacadeLayer Web Services Facade Business Facade Transactional DAL Nontransactional DAL User Services Maintaining business rules and persisting data is a complex undertaking. Many logical business objects and physical components are needed to facilitate these activities. Without a facade layer, user services would need to interact with the business logic layer and the DAL. Thefacadelayer was introduced so that user services would not need to handle this complexity, and to provide a uniform layer for handling security and robustness issues. The key functions of a facadelayer are to: ! Act as a logical buffer between user services and the underlying application architecture (business logic layer and DAL). ! Act as a security buffer for the underlying application components. ! Maintain the robustness of an application. Topic Objective To provide background about the business problem. Lead-in In this topic, you will learn about the business problem facing designers who need to implement facade layers. 4 Module5:TheFacadeLayer Business Requirements FacadeLayer Web Services Facade Business Facade Public Web Pages Internal Functionality A facadelayer represents a unified interface for the business logic components. User services communicate with the business logic and DAL services by sending requests to thefacade layer. Although the business logic or DAL service objects perform the actual work, thefacadelayer might need to perform work of its own to translate its interface to the business services and DAL services interface. The most important point is that clients (the user services) that use thefacade do not have to access its subsystem objects (business services and DAL services) directly. Thefacadelayer (Web services and business) runs on the middle-tier nodes that can be physically separate from the user services. Consequently, thefacadelayer also acts as a security barrier for the business services and the DAL services. Thefacadelayer requires additional resources for managing and executing thefacadelayer components that create additional costs. These additional costs are typically justified by the benefits of simplifying the interface for user services. A facadelayer fulfills three important functions: ! The first function is to receive input from the user services and pass input values to the business logic. Because user services access thefacade layer, user services do not need to understand the logical or physical structure of the business logic. Furthermore, whenever the business logic model changes, user services are not affected by these changes because they interact with the business facade layer. ! The second function is to act as a conduit for requests from clients to the business logic layer to retrieve or update information regarding any of the business objects. Thefacadelayer also acts as a conduit for requests for retrieval of information directly from the DAL. ! The third function is to maintain the robustness of an application. Topic Objective To provide background about thefacade layer. Lead-in In this topic, you will learn the business requirements of the two types of classes that make up thefacade layer. [...].. .Module 5:TheFacadeLayer A good strategy for designing thefacadelayer is to create one object for each use case identified in the conceptual design that is used directly by an actor Thefacadelayer consists of two layers: the business facadelayer and the Web services facadelayerThe distinction between these two reflects the type of functionality exposed The Web services facadelayer exposes... can check their travel history—then security must be used in the Web services facade Module 5:TheFacadeLayer 25 Facade Classes Topic Objective To provide information about the definition of classes for thefacadelayer Lead-in In this topic, you will learn about the definition of classes for thefacadelayer User Services Facade Classes The logical design of facade classes maps all of the different... facadelayer In particular, you will learn how to define classes for both a Web services facade and a business facade 24 Module5:TheFacadeLayerTheFacadeLayer Topic Objective To provide information about the logical design of a facade Lead-in In this topic, you will learn about the logical design patterns that can be associated with a facadeFacade Subsystem Classes Thefacadelayer implements the. .. clicking the Look Up option Module 5:TheFacadeLayer 23 # Logical Design of theFacadeLayer Topic Objective To provide an overview of the section topics and objectives ! TheFacadeLayer Lead-in ! Facade Classes In this section, you will learn about facade logical design In this section, you will learn about the logical design considerations that apply to a Web services facadelayer and to a business facade. .. and the component does not catch the exception, COM+ catches the exception and terminates the process The use of the failfast policy in this case is based on the assumption that the exception has put the process into an indeterminate state, and that it is not safe to continue processing Module 5:TheFacadeLayer 21 Finding the Source of an Error Topic Objective To provide background about finding the. .. layer implements theFacade structural design pattern TheFacade structural design pattern is an important part of creating a unified interface for the internals of a Web-based application Thefacadelayer must hide the internal structure of the business logic layer and the DAL from the user services Thefacadelayer acts both as a buffer that can maintain state and as a firewall to the internal system... Folder>/msdntrain/1910/DemoCode/Mod05/Security, and then click Open 6 Click Next on the next wizard page 7 Click Finish ! Create a role 1 Under the Security COM+ application, click the Roles folder 2 On the Action menu, point to New, and then click Role 3 Type Admin, which is the name of the new role, and then click OK Module 5:TheFacadeLayer 15 ! Assign roles to a component 1 Under the Security COM+ application, expand the Components... classes to corresponding facade classes In general, the rich client use cases are mapped to Web services facades and thin clients are mapped to business facades 26 Module5:TheFacadeLayer # Physical Design of theFacadeLayer Topic Objective To provide an overview of the section topics and objectives ! Authentication Lead-in ! Windows 2000 Authentication ! Membership Authentication ! Robustness... implement a facade as a part of their architecture To model a facade is straightforward For every use case there is a user services class For every user services class, there is a corresponding facade class Two subsets of thefacade classes are the Web service facade classes and the business facade classes The designation implies the type of functionality that is exposed: external or internal The logical... section, you will learn about the physical design of thefacadelayer While the logical design of thefacadelayer focuses on thefacade structural design pattern, the physical design focuses on the use of COM+ components In particular, the physical design focuses on technologies used for security and the techniques for implementing robustness In this section, you will learn about the physical design considerations . for a facade layer. 2 Module 5: The Facade Layer # ## # Introduction to the Facade Layer ! The Business Problem ! Business Requirements A facade layer. in the business logic layer and the data access layer (DAL). This module presents the two types of facade layers: the Web services facade layer and the