Tài liệu Module 2: Architecture and Structural Design Patterns pdf

34 722 0
Tài liệu Module 2: Architecture and Structural Design Patterns pdf

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Module 2: Architecture and Structural Design Patterns Contents Overview Introduction to Architecture Templates Design Patterns Used in Architecture The Enterprise Template 11 Other Architecture Templates 17 MSF Enterprise Architecture 20 Best Practices 23 Lab 2: Architecture and Structural Design Patterns 24 Review 28 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 Module 2: Architecture and Structural Design Patterns Instructor Notes Presentation: 60 Minutes Lab: 45 Minutes This module provides students with a detailed presentation about architecture templates, which describe the building blocks of an application To use a building—or architecture—analogy, consider the structure of a building: a foundation, pillars, walls, and an exterior shell In this module, you will be introduced to the structure of an application After completing this module, students will be able to: ! Describe architecture templates ! Describe the creational design patterns ! Describe the structural design patterns ! Describe the Enterprise template ! Describe Enterprise Architecture and how it relates to an Enterprise template 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_02.ppt ! Module 2: Architecture and Structural Design Patterns ! Lab 2: Architecture and Structural Design Patterns Preparation Tasks To prepare for this module, you should: ! Read all of the materials for this module ! Complete the lab iii iv Module 2: Architecture and Structural Design Patterns Module Strategy Use the following strategy to present this module: ! Introduction to Architecture Templates The purpose of this topic is to introduce students to the need for a model of the “real world” in the logical design The architecture template represents the structure of the logical design model This is only an introduction Avoid providing the details that will be provided in subsequent sections In the topic “Transition from Conceptual to Logical Design,” focus on the first step in the transition from conceptual design to logical design, which is to identify the creational and structural design patterns that can be used in the architecture of the desired solution In the topic “What Are Architecture Templates?” emphasize that the architecture template defines how to create a Microsoft Windows® 2000 solution ! Design Patterns Used in Architecture The purpose of this section is to introduce students to creational and structural design patterns that can be used to create a logical architecture In the topic “Creational,” focus on the sample of the Abstract Factory and its implementation as a Remote Data Service (RDS) in the Microsoft Data Access Components (MDAC) Mention that creational design patterns are now implemented as Windows 2000 capabilities and emphasize the need to continue to create additional creational patterns that might evolve into additional operating system services In the topic “Structural,” focus on the sample of the Composite design pattern and its implementation as a Component Object Model (COM) collection object Mention that another structural design pattern that is going to be heavily used in an architecture template is the Facade ! The Enterprise Template The purpose of this section is to introduce students to the components of the Enterprise template and to emphasize the new additions: facade, data access layer (DAL), and system services In the topic “Facade Sequence Diagram,” point out the sequence in which the Web services facade layer is used In the topic “System Services,” review briefly the Decorator structural design pattern and the use of authenticate and audit as examples of system services ! Other Architecture Templates The purpose of this section is to introduce students to the possibility of using other architecture templates and in particular to introduce two others: the Web template and the Business template ! MSF Enterprise Architecture The purpose of this section is to introduce students to the Microsoft Solutions Framework (MSF) Enterprise Architecture and to differentiate it from the Enterprise template You can use the following analogy to explain the difference: Enterprise Architecture is like a master plan for the continued development of a village, whereas the architecture template is the building code for all of the buildings that will be constructed in the village Module 2: Architecture and Structural Design Patterns v In the topic “MSF Enterprise Architecture Overview,” explain that the primary purpose of Enterprise Architecture is to position all applications on an information technology (IT) landscape, and focus on the applications that have fallen into the abyss ! Best Practices Use the village analogy to emphasize that you can’t build a village without a building code You also want the code to reflect good practices Finally, you want the code to incorporate enough flexibility to allow people to be creative in designing their homes Lab Strategy ! Lab 2: Architecture and Structural Design Patterns The purpose of this lab is to help students become more familiar with structural design patterns and architecture templates Consider discussing the scenario and problem statement from the lab before letting students work on the lab Make sure all students understand the scenario Don’t embellish the scenario; keep it simple Discuss with students their answers to Lab Module 2: Architecture and Structural Design Patterns # Overview Topic Objective To provide an overview of the module topics and objectives ! Introduction to Architecture Templates Lead-in ! Design Patterns Used in Architecture ! The Enterprise Template ! Other Architecture Templates ! MSF Enterprise Architecture ! Best Practices In this module, you will learn about architecture and Enterprise templates and about design patterns that are used in the architecture template In this module, you will be introduced to architecture templates Architecture templates describe the building blocks of an application To use a building or architecture analogy, consider the structure of the building This structure consists of a foundation, pillars, walls, and an exterior shell In this module, you will be introduced to the structure of an application After completing this module, you will be able to: ! Describe architecture templates ! Describe the creational design patterns ! Describe the structural design patterns ! Describe the Enterprise template ! Describe Enterprise Architecture and how it relates to an Enterprise template Module 2: Architecture and Structural Design Patterns # Introduction to Architecture Templates Topic Objective To provide an overview of the section topics and objectives ! The Problem Lead-in ! Transition from Conceptual to Logical Design ! What Are Architecture Templates? In this section, you will learn what makes up an architecture template Architecture templates describe the structure of an application They tell you the layers that an application should have, and the type of objects (logical design) and components (physical design) that should be included in each layer In this section, the architecture template will be placed in the proper context of the problem that is being addressed This will be followed by a presentation about the process of transitioning from conceptual design to logical design The section concludes with a precise definition of what makes up an architecture template Module 2: Architecture and Structural Design Patterns The Problem Topic Objective To provide a background about the business problem Real World User Services Lead-in In this topic, you will learn about the business problem facing application designers that leads to the need for a system services layer Business Services Data Services In the preceding slide, the cloud represents the “real world.” The applications that you design are representations of the real world While at times you night come to believe that a computer-based application is the real world, it is still only a view of the real world In other words, activities take place in the real world but are recorded in a view—the computer application To create a precise and concise representation of the real world, it is necessary to abstract from the complexities of the real world; this abstraction is the model The model is built from pieces that interact that are called components The interactions between the components and the behavior of each of the components define the salient features of the real world as they are represented in the model Another way of phrasing this is to say that the model imposes structure on the real world in order to be able to represent it The first question that comes up is “What shape should this structure be?” That is the issue that the architecture template addresses The representation of the real world in a computer-based application model is an art rather than a science Having said that, there are techniques that improve the quality of the design of the model In particular, object oriented design methodology offers a systematic approach for designing computer applications that successfully model the real world Module 2: Architecture and Structural Design Patterns Transition from Conceptual to Logical Design Topic Objective To provide a background about the logical design Lead-in Enter New Requisition In this topic, you will learn about the transition from conceptual design to logical design and the use of creational and structural design patterns in this process Requestor Vendor Design Patterns Requestor Requisition Vendor Object oriented analysis and design methodology begins with a conceptual representation of an application that consists of actors and use cases, as described in Module 1, “Designing Distributed Applications for Windows 2000.” The next step in the design process is to map the conceptual design to a logical design In this step, you must determine the solution characteristics, which are the restrictions on the representation of the real world in the model Using creational and structural design patterns, you map the solution characteristics to the template architecture In general, solution characteristics include consistency, reduction, reusability, the ability to integrate, maintainability, and flexibility Creational design patterns abstract the instantiation process A client becomes independent of how its objects are created or composed For example, creational design patterns include a Factory Method that allows you to create objects at run time An example of a Factory Method implementation is the CreateObject method in VBScript (a script written in the Microsoft Visual Basic® Scripting Edition) Structural patterns, on the other hand, are concerned with how logical objects are composed to create larger structures For example, structural patterns include a Composite pattern that allows you to represent part/whole hierarchies An example of a Composite implementation is a collection For example, a Recordset has a Fields collection, which is a grouping of Field objects 14 Module 2: Architecture and Structural Design Patterns Facade Sequence Diagram Topic Objective To understand the operation of a facade Web Services User Web Services Facade Layer Business Rules Layer Lead-in In this topic, you will learn about the sequence in which a facade is used WebRequest() Request() Reply() Reply() In order to better understand how a facade is used within the context of an Enterprise template, let’s look at a typical sequence diagram The sequence diagram, shown in the preceding slide, illustrates that the Web services facade hides the complexity of the business logic layer from user services A Web services user only accesses the Web services facade The Web services facade encapsulates the “workflow” associated with the user interface (for example, the series of screens through which you must progress in order to complete an online purchase) The Web services facade translates the request to the appropriate objects within the business rules layer Module 2: Architecture and Structural Design Patterns Data Access Layer Topic Objective To understand the DAL Lead-in In this topic, you will learn about the use of the DAL Facade Layer Web Services Facade Business Facade Disconnected Business Logic Layer Connected Business Logic Layer Data Access Layer Transactional DAL Nontransactional DAL Data Services The second addition to the Enterprise template is to add a DAL as a temporary repository of data that is being passed to and from data services The DAL is usually separated into two types: the objects that only perform retrieval and not participate in transactions, and the objects that manipulate data and can participate in transactions The DAL is an example of using the Adapter structural pattern within the Enterprise template 15 16 Module 2: Architecture and Structural Design Patterns System Services Topic Objective To understand system services User Services Lead-in In this topic, you will learn about the use of system services Facade Layer Web Services Facade Business Facade Disconnected Business Logic Layer System Services Connected Business Logic Layer Data Access Layer Transactional DAL Nontransactional DAL The third and final addition to the Enterprise template is system services System services is an example of the use of the Decorator structural design pattern within the Enterprise template The Decorator structural design pattern defines a mechanism for dynamically attaching responsibilities to an object A Decorator is typically associated with a component When the Decorator receives a request for an operation, it forwards the request to its associated component object An example of an implementation of a Decorator is a search component that forwards requests for the search to an underlying search engine The system services layer is concerned with parts of the application that provide system service or system infrastructure functionality Any layer within the architecture can use the system services layer Examples of system services objects are an Authentication object that uses objects from another layer to perform its functionality and an Audit object that allows objects from all other layers to call it to log their activity Module 2: Architecture and Structural Design Patterns 17 # Other Architecture Templates Topic Objective To provide an overview of the section topics and objectives ! The Web Template Components Lead-in ! The Business Template Components In this section, you will learn about other architecture templates The Enterprise template is not the only architectural template that can be derived usefully from the use of design patterns and the Microsoft Enterprise strategy Other architectural templates can be variations on the Enterprise template In this section, two other architecture templates and their components will be presented: ! The Web template components ! The Business template components 18 Module 2: Architecture and Structural Design Patterns The Web Template Components Topic Objective To understand the Web template User Services Lead-in In this topic, you will learn about the components of a Web template Facade Layer Web Services Facade Disconnected Business Logic Layer System Services Connected Business Logic Layer Data Access Layer Transactional DAL Nontransactional DAL A Web template differs from an Enterprise template in that there is no business services facade The only facade is the Web services facade This architectural template is useful when you are creating applications that only have Web access over the Internet or intranet A Web application might have parts that are anonymously accessible and others that require certificate-based authentication Both parts of the application would be part of the same “Web facade.” Module 2: Architecture and Structural Design Patterns 19 The Business Template Components Topic Objective To understand the Business template User Services Lead-in In this topic, you will learn about the components of a Business template Facade Layer Business Facade Disconnected Business Logic Layer System Services Connected Business Logic Layer Data Access Layer Transactional DAL Nontransactional DAL A Business template differs from an Enterprise template in that there is no Web services facade The only facade is the business facade This architecture template is useful when you are creating applications that not have any Web access 20 Module 2: Architecture and Structural Design Patterns # MSF Enterprise Architecture Topic Objective To provide an overview of the section topics and objectives ! MSF Enterprise Architecture Overview Lead-in ! Reconciling an Enterprise Architecture with an Enterprise Template In this section, you will learn about the MSF Enterprise Architecture The Enterprise template should not be confused with the Microsoft Solutions Framework (MSF) Enterprise Architecture While the Enterprise template is a blueprint for the design of a particular application, the Enterprise Architecture is the sum of all the applications that are being used to conduct the business of the enterprise The Enterprise Architecture focuses on the whole and the interaction between the parts (inter) while the Enterprise template focuses on the part and how it is constructed (intra) The MSF Enterprise Architecture describes the business activities of an organization It shows how an organization delivers products and services It shows how a business interacts with its customers and suppliers Finally, it describes the business processes In this section, the Enterprise Architecture will be reviewed For a more detailed presentation about the MSF Enterprise Architecture, see Course 1515: Principles of Enterprise Architecture In this section, the following topics will be covered: ! MSF Enterprise Architecture overview ! Reconciling an Enterprise Architecture with an Enterprise template Module 2: Architecture and Structural Design Patterns 21 MSF Enterprise Architecture Overview Topic Objective To describe an MSF Enterprise Architecture Organizations Are at Different Points on the IT Landscape Lead-in Avoiding the Abyss In this topic, you will learn about what comprises MSF Enterprise Architecture Moving Ahead Leading Competitive Frozen in the Past Climbing Out Falling In In the Abyss The MSF Enterprise Architecture also describes the applications and information that support the business activities It describes the technologies that power the applications and the information The Enterprise Architecture is a representation of a dynamic business system at a single moment in time An organization’s use of information technology (IT) in the delivery of applications can be mapped to an IT landscape Different organizations are at different points on the IT landscape The characteristic feature of an IT landscape is the abyss The abyss is where the danger lies: IT applications are too complex, not deliver on their promise, and are too costly As organizations grow from simple to complex, their application needs grow with them In order to create a successful Enterprise Architecture, it is necessary to characterize an organization’s IT applications relative to their position in the IT landscape Before you can plan an enterprise’s way to avoid the abyss, get out of it, distance itself from it or go beyond it, you need to know how to evaluate its position relative to the abyss The three areas that should be diagnosed to position enterprises on the IT landscape are: ! IT Assets Evaluated on the basis of the application portfolio complexity, the complexity of the technology infrastructure, and the difficulty in acquiring and retaining skilled human resources ! IT Management Process Evaluated on the basis of strategic direction setting, technical direction setting, funding, execution, and review ! IT/Business Performance Evaluated on the basis of spending and results Is good value received for every dollar spent? 22 Module 2: Architecture and Structural Design Patterns Reconciling an Enterprise Architecture with an Enterprise Template Topic Objective To understand the relationship between an Enterprise Architecture and an Enterprise template Technology Rate of Change Lead-in In this topic, you will learn how the Enterprise template fits into the Enterprise Architecture Business EA Versioned Releases Traditional Release Study and Analysis Obsolete Solution Time In Six-Month Cycles In Internet time, the development time for applications has been reduced from years to months People want results right away Enterprise Architecture versioned releases are six months apart People want to see the contribution of IT to the Enterprise strategy and the bottom line in six-month increments To deliver on the Enterprise Architecture promise, it is necessary to build an Enterprise plan that fits within a dynamic Enterprise Architecture That is where the Enterprise template comes in The Enterprise template increases the chances for Enterprise Architecture success by providing: ! Flexibility Adapt to a wide range of changes in business and technology without having to redevelop and redeploy the entire application ! Extensibility Add new capabilities to an application without rewriting or redeploying the entire application ! Interoperability Provide access to functionality and data provided by existing heterogeneous systems ! Reduce cost of ownership Provide facilities and approaches to manage the cost of an application throughout its entire life cycle of planning, building, deploying, managing, and disposing Module 2: Architecture and Structural Design Patterns 23 Best Practices Topic Objective To provide a discussion of the best practices for the Enterprise template ! Always Have an Architecture Template Lead-in ! Ensure That Solution Characteristics Are Reflected in Your Architecture ! Be Generic and Not Too Specific In this topic, you will learn the three best practices for architecture templates ! Always have an architecture template You must have a solution in context of the relationship with the other applications ! Ensure that solution characteristics are reflected in your architecture ! Be generic and not too specific You are not yet working at the level of logical design At this stage, you are still “working in the large.” 24 Module 2: Architecture and Structural Design Patterns Lab 2: Architecture and Structural Design Patterns Topic Objective To introduce the lab Lead-in In this lab, you will extend the Enterprise template that has been chosen for the logical design of Market Purchasing Explain the lab objectives Objectives After completing this lab, you will be able to: ! Choose and apply structural design patterns to an application architecture based on a given use case Prerequisites Before working on this lab, you must: ! Complete Module 2, “Architecture and Structural Design Patterns.” ! Complete Lab 1, “Reviewing the Market Purchasing Conceptual Design.” Scenario The Market Purchasing application demonstrates the conceptual and logical design of an application Based on the use cases presented in the Market Purchasing functional specification, the Enterprise template was chosen as the appropriate architecture template for the Market Purchasing design The current accounting system works asynchronously Requisitions requiring approval are batched and saved to an Extensible Markup Language (XML) file, which is sent to the accounting system When the accounting system processes the XML file, it creates a response XML file containing the status for each requisition (approved or rejected) During the planning phase of the current version of Market Purchasing, the customer requested the addition of a new use case called Synchronous Fund Approval The customer requested that the development team assess the impact on the design of this new use case Module 2: Architecture and Structural Design Patterns 25 The customer recently purchased a new accounting package that has an extensive budgeting module The new accounting package exposes a business class that allows other applications to directly post budget requests This class includes a method Allocate(Cost Center, Account Number, Amount) that allows another application to request an allocation of a budget for a purchase If the funds are available, the allocation is granted The return value from the method is an allocation ID The class also includes a method Cancel(Allocation ID) that cancels an allocation Using these two methods, the Market Purchasing application could allocate funds for requisitions synchronously without creating XML files The following business rules are associated with the scenario that the customer wants to implement: ! There should be only one allocation per line item in a requisition That is, each line item results in exactly one call to the Allocate method ! The amount of allocation per line item cannot exceed the level authorized by the manager of the requestor In discussions with the customer, you determine that the following tasks will occur when the synchronous accounting package is used: Synchronous Fund Approval Task Sequence Select requisition for fund approval Request fund allocation from accounting (Allocate) Post new requisition status Log activity Problem The Market Purchasing product manager wants to respond to the customer’s request, yet is reluctant to limit the new use case to a particular accounting system The product manager wants Market Purchasing to easily run on other accounting systems if necessary Therefore, Market Purchasing should not be making direct method calls to the accounting system Estimated time to complete this lab: 45 minutes 26 Module 2: Architecture and Structural Design Patterns Exercise Extending the Architecture Template for Market Purchasing In this exercise, you will extend the Enterprise template that has been chosen for the logical design of Market Purchasing ! Determine the impact on design Read the preceding scenario and problem description In Word 2000, open the Market Purchasing Functional Spec.doc file This file is in the install folder\Labs\Spec folder Read the Conceptual design use cases for Market Purchasing in the functional specification If the new synchronous accounting system is implemented, which use cases will change? The Obtain Requisition Approval use case would no longer write requisitions to a file It would call the accounting system for approval Also the Approve/Deny Funds use case would no longer read a file from accounting Approve/Deny Funds would probably be removed, or changed to use the synchronous accounting system Market Purchasing must not make direct method calls to the accounting system, so that different accounting systems can be used without rewriting Market Purchasing Given this restriction, what structural design pattern would you use to implement communication between Market Purchasing and the accounting system? The Adapter pattern This structural pattern would convert the interface of a class into another interface that a client expects This pattern would convert accounting system interfaces into a consistent interface for Market Purchasing If the accounting system changed, the Adapter would be rewritten to expose the new accounting system through the same interface for Market Purchasing Module 2: Architecture and Structural Design Patterns 27 In the space below, draw a new architecture template diagram for Market Purchasing that includes the structural design pattern from above Based on the lecture in Module 2, would you consider the Bridge and Composite structural design patterns to be useful extensions for the Market Purchasing Architecture template? Why or why not? Bridge – This structural pattern decouples an abstraction from its implementation The abstraction forwards client requests to the implementation This structural design pattern would be useful in a case in which there are several implementations (algorithms) for a particular function depending on some criteria for choosing between them In Market Purchasing, there are no use cases that currently have the requirements that would justify adding a Bridge to the architecture template Composite – This structural pattern allows composite objects to be represented as a tree structure that would represent either a whole or a partial hierarchy The Composite design pattern allows client applications to treat individual objects and compositions of objects uniformly Clients can use the Composite structural pattern to interact with objects in the composite structure If the recipient is a leaf, the request is handled directly If the recipient is a composite, it usually forwards the request to its child components One possible use of the Composite design pattern is to treat a requisition and its line items as a composite pattern The requisition would be the root of the composition and the line items would be leaves 28 Module 2: Architecture and Structural Design Patterns Review Topic Objective To reinforce module objectives by reviewing key points ! Describe architecture templates Lead-in ! Describe the creational design patterns ! Describe the structural design patterns ! Describe the Enterprise template ! Describe Enterprise Architecture and how it relates to an Enterprise template The review questions cover some of the key concepts taught in the module What are the two types of design patterns used in architecture templates? Creational Structural What three additions are made to the Microsoft Enterprise strategy to create an Enterprise template? Facade DAL System services What is the danger point in the IT landscape called? The abyss ... this module, you need the following materials: ! Microsoft® PowerPoint® file 1910A_02.ppt ! Module 2: Architecture and Structural Design Patterns ! Lab 2: Architecture and Structural Design Patterns. .. design patterns can be used to define an architectural template This section discusses creational and structural design patterns and their uses Module 2: Architecture and Structural Design Patterns. .. in designing their homes Lab Strategy ! Lab 2: Architecture and Structural Design Patterns The purpose of this lab is to help students become more familiar with structural design patterns and architecture

Ngày đăng: 10/12/2013, 16:16

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan