Скачать презентацию Designing the End to End NET Application Hans Скачать презентацию Designing the End to End NET Application Hans

189087dd499c5e4fa600132002631ae5.ppt

  • Количество слайдов: 46

Designing the End to End. NET Application Hans Verbeeck hansver@microsoft. com Developer Consultant Microsoft Designing the End to End. NET Application Hans Verbeeck hansver@microsoft. com Developer Consultant Microsoft EMEA

Agenda n n A usecase driven approach From Use Case to data model to Agenda n n A usecase driven approach From Use Case to data model to physical database design Demo Choices to make up front n n n Type of client Partitioning of the application Host for the middle tier Data carrier Conclusions 2

Why analize? n n n Analyze the Business Problem Understand the Business Logic Consider Why analize? n n n Analyze the Business Problem Understand the Business Logic Consider Enterprise Issues 3

UML – Unified Modelling Language 9 types of diagrams n n n n n UML – Unified Modelling Language 9 types of diagrams n n n n n Class (Package) diagrams Use Case diagrams Statechart diagrams Object diagrams Sequence diagrams Collaboration diagrams Activity diagrams Component diagrams Deployment diagrams 4

Use Cases are. . . n n Textual description of a general interaction with Use Cases are. . . n n Textual description of a general interaction with the system Services or functions provided by the system to its users USE CASES List Available Products User ACTORS Raise Purchase Order Vendor System Process Order SYSTEM BOUNDARY 5

Applied Use Cases n Actors are our user roles Browser n Reporter n (data) Applied Use Cases n Actors are our user roles Browser n Reporter n (data) Admin n Buyer + External systems offering their shopping catalogs through Web Services n n Use Cases n Course grained in design 6

Football 247. net use case diagram Browse Football Data Shopping Buy Browser Authenticatio n Football 247. net use case diagram Browse Football Data Shopping Buy Browser Authenticatio n User Maintenace … Game Reporting Reporter Import Football Data Game Maintenance Administ rator 7

Agenda n n A usecase driven approach From Use Case to data model to Agenda n n A usecase driven approach From Use Case to data model to physical database design Demo Choices to make up front n n n Type of client Partitioning of the application Host for the middle tier Data carrier Conclusions 8

Beyond the Use Case n Pick most important Use Case first n n Browse Beyond the Use Case n Pick most important Use Case first n n Browse Football Data Most of the Football 247. net web site is served by this use case n n n +90% of operations will be read operations Example: A user browses to the homepage of the football 247. net site. He takes a look at the league table for the Premier League. He clicks on his favorite team and sees the upcoming games, he continues by looking at the results for the past games and finally he checks the news about the team Our reasoning: When a Browser clicks on a team he’s most likely interested in different kinds of information about the team 9

Football 247. net Football 247. Common Application Architecture . Core. Datasets Solution Structure System Football 247. net Football 247. Common Application Architecture . Core. Datasets Solution Structure System Architecture Football 247. Presentation. Administrator, . Reporter User Tier . Web. Site . Win. Controls . Web. Controls . Facades Football 247. Business Tier . Facades . Host . Services Football 247. Data Tier . Data. Access 10

The Façade Pattern Provides a simple interface to a complex system Façade 11 The Façade Pattern Provides a simple interface to a complex system Façade 11

The Browser. Facade Our Façades are Use Case Façades n n Get. Divisions() : The Browser. Facade Our Façades are Use Case Façades n n Get. Divisions() : Division. Data Get. Teams. By. Division. ID(in division. ID : int) : Team. Data. . . Get. Team. Details. By. ID(. . . ) : Team. Detail. Data 12

Sequence Diagrams Use them to get an idea of methods and data involved in Sequence Diagrams Use them to get an idea of methods and data involved in more complex operations reporter. Facade game. Services Post. Game. Events (Game. Event. Data) Validate (Event. Type) game. Event Type. Validator If it’s a goal event then the game’s score Should be updated in the same transaction OK X game. Events Data. Accesor Add. Game. Event (Game. Event. Data) X game Data. Accesor Get. Game. By. ID(ID) Game. Data Update. Game(Game. Data) X X X 13

Designing Datasets Get. Teams. By. Division. ID(in division. ID : int) : Team. Data Designing Datasets Get. Teams. By. Division. ID(in division. ID : int) : Team. Data Get. Team. Details. By. ID(. . . ) : Team. Detail. Data «Dataset» Team. Detail. Data +Teams +Players +News. Items +Future. Games +Past. Games «Data. Table» Teams +Team. ID +Team. Name 14

Agenda n n A usecase driven approach From Use Case to data model to Agenda n n A usecase driven approach From Use Case to data model to physical database design Demo Choices to make up front n n n Type of client Partitioning of the application Host for the middle tier Data carrier Conclusions 15

Visio for Enterprise Architects Use Case Façade Data. Set Data. Table 16 Visio for Enterprise Architects Use Case Façade Data. Set Data. Table 16

Agenda n n A usecase driven approach From Use Case to data model to Agenda n n A usecase driven approach From Use Case to data model to physical database design Demo Choices to make up front n n n Type of client Partitioning of the application Host for the middle tier Data carrier Conclusions 17

Web Forms or Windows Forms Do you want thin, thick, fat, rich, dumb, smart, Web Forms or Windows Forms Do you want thin, thick, fat, rich, dumb, smart, Windows or Internet? Web Forms User Experience Deployment Updating Security Mobile Relatively hard to make web pages dynamic with DHTML. Easy. Only on server. Windows Forms Dynamic, responsive UI. End users love it. Can be deployed through web server. . NET Framework required on client. Reach Rich Shadow copying prevents restarts of the web application Authorized actions depend on zone. Can update on web server. Microsoft Mobile Internet Toolkit . NET Compact Framework Authorized actions depend on zone. Code Access Security. 18

Football 247. net clients Business Presentation admin reporter browser WS Façade (asmx) WIN Service Football 247. net clients Business Presentation admin reporter browser WS Façade (asmx) WIN Service ASP. NET UI (aspx) Data WS Façade or Biz Services D A L S P ES Façade 19

Agenda n n A usecase driven approach From Use Case to data model to Agenda n n A usecase driven approach From Use Case to data model to physical database design Demo Choices to make up front n n n Type of client Partitioning of the application Host for the middle tier Data carrier Conclusions 20

Partitioning a distributed application n Deployment Security Scalability / Performance 21 Partitioning a distributed application n Deployment Security Scalability / Performance 21

Partitioning for deployment How many physical tiers must be supported? n Possible deployment scenarios Partitioning for deployment How many physical tiers must be supported? n Possible deployment scenarios n n n Stand alone application (single box) Distributed application Hosted stand alone application Hosted distributed application Design Patterns make abstraction of component location and inter-component-communication Football 247. net is designed for flexible deployment 22

Partitioning for deployment one, two, three-tier Business Single box Presentation admin reporter browser WS Partitioning for deployment one, two, three-tier Business Single box Presentation admin reporter browser WS Façade (asmx) WIN Service ASP. NET UI (aspx) + Easy to admin + Most hosting companies offer this + Performance might benefit from nonetwork-hops Data WS Façade or Biz Services D A L S P ES Façade - Scalability: can only scale up - Security: if this machine is compromised, everything is 23

Partitioning for deployment one, two, three-tier Business Web Server as application server Presentation admin Partitioning for deployment one, two, three-tier Business Web Server as application server Presentation admin reporter browser WS Façade (asmx) WIN Service ASP. NET UI (aspx) + Performance: minimized network hops + More options for security and scalability Database Server WS Façade or Biz Services D A L S P ES Façade - Scalability: UI and middle-tier must scale together - Security: when web server is compromised, the hacker can access data access code 24 - cost

Partitioning for deployment one, two, three-tier Presentation Web Server admin reporter browser Business Application Partitioning for deployment one, two, three-tier Presentation Web Server admin reporter browser Business Application Server WS Façade (asmx) WIN Service ASP. NET UI (aspx) + Scalability: web farms + Security: DMZ + Middle tier is a resource to be used by many different clients Database Server WS Façade or Biz Services D A L S P ES Façade - Perf: network hops - Complexity: Web Server is not in corporate domain - cost 25

Partitioning for security n n Keep most complex deployment scenario you need to support Partitioning for security n n Keep most complex deployment scenario you need to support in mind Football 247. net n Web Server in DMZ + Application Server + Database Server n n Single box at hosting company n n DMZ: Not in domain so no integrated Windows authentication Not in a Windows Domain Decision: Custom Authentication n Pluggable architure Ready for future technologies (WS-Security) Runs in any deployment scenario 26

Custom HTTP Handler unpacks credentials, raises event in global. asax which creates and caches Custom HTTP Handler unpacks credentials, raises event in global. asax which creates and caches principal. Authentication and authorization Based on role, one of. NET role four connectionstrings based security used(browser, admin, is Business Data reporter, default). User supplies User Presentation ID and Password admin reporter browser WS Façade (asmx) WIN Service WS Façade < /> Biz User or and Services ID Password travel in /> Soap. Headers < User ID and ASP Password travel in. NET UI Soap. Headers (aspx) D A L S P ES Façade 27

Partitioning for Scalability / Performance Never believe anything anyone says about perf n n Partitioning for Scalability / Performance Never believe anything anyone says about perf n n Test performance yourself Performance tests should model real world scenarios n n Do nothing tests show only the overhead Real apps show overhead as an often insignificant percentage of the overall work Set the target based on capacity planning Test regularly to insure you are hitting target 28

Partitioning for Scalability / Performance Designing for scalability – our choices n Stored Procedures Partitioning for Scalability / Performance Designing for scalability – our choices n Stored Procedures & System. Data. SQLClient + performance + sp’s hide database details & protects database tables + one location for SQL coding - portability n Web Services for Business components + easy of deployment (xcopy) + standards based + future ready - performance n Optimized for reads + Reduced cross process / cross machine calls == better performance + user experience - No true OO middle tier 29

Agenda n n A usecase driven approach From Use Case to data model to Agenda n n A usecase driven approach From Use Case to data model to physical database design Demo Choices to make up front n n n Type of client Partitioning of the application Host for the middle tier Data carrier Conclusions 30

Options for hosting the Middle Tier n n Web Services Façade Enterprise Services Façade Options for hosting the Middle Tier n n Web Services Façade Enterprise Services Façade n n Hosted by IIS, communication through Remoting Loaded as Library Application in the Presentation Web Services Façade or the ASP. NET Web Application Serviced. Components are COM+ Server application Windows Service 31

Options for hosting the Middle Tier Web Services Façade + easy to deploy + Options for hosting the Middle Tier Web Services Façade + easy to deploy + easy to reuse + can publish in Business UUDI Presentation admin reporter browser Data WS Façade (asmx) WIN Service ASP. NET UI (aspx) WS Façade Biz Services D A L S P -Performance -Always X-Process 32

Serviced. Components Huge diference between Server and Library Applications Server Registration COM Interop Updating Serviced. Components Huge diference between Server and Library Applications Server Registration COM Interop Updating Security Needs to be registered in COM+ catalog and in the GAC For every call Disable, recycle, update and re-enable Runs with own identity Library COM+ catalog Only when object is instantiated Shadow Copying Runs in security context of the caller 33

Options for hosting the Middle Tier Enterprise Services Façade + can configure remoting + Options for hosting the Middle Tier Enterprise Services Façade + can configure remoting + performance Business Presentation admin reporter browser Data WS Façade (asmx) WIN Service ASP. NET UI (aspx) ES Façade hosted in IIS Biz Services D A L S P -Registration -Always X-Process 34

Options for hosting the Middle Tier Enterprise Services Façade Business Presentation Data + performance Options for hosting the Middle Tier Enterprise Services Façade Business Presentation Data + performance admin reporter browser WS Façade (asmx) WIN Service ASP. NET UI (aspx) ES Façade. Library app. Loaded on client process Biz Services D A L S P -Registration -Have to do authorization and authentication in the presentation tier 35

Options for hosting the Middle Tier Enterprise Services Façade + COM+ services + DCOM Options for hosting the Middle Tier Enterprise Services Façade + COM+ services + DCOM has some nice features Business Presentation admin reporter browser Data WS Façade (asmx) WIN Service ASP. NET UI (aspx) ES Façade hosted in DLLHost (server app) Biz Services -Registration (GAC) -Always X-Process -DCOM is COM interop D A L S P 36

Agenda n n A usecase driven approach From Use Case to data model to Agenda n n A usecase driven approach From Use Case to data model to physical database design Demo Choices to make up front n n n Type of client Partitioning of the application Host for the middle tier Data carrier Conclusions 37

Data carrier options Chose based on programming model, performance and maintainability n n Datasets Data carrier options Chose based on programming model, performance and maintainability n n Datasets Typed Datasets XML Collections 38

Data Carrier Options Datasets n Pros n Disconnected model n n n Performance Abstraction Data Carrier Options Datasets n Pros n Disconnected model n n n Performance Abstraction XML aware Databinding Cons n n Type checking at runtime Diffgrams XML overhead (even when used with remoting over tcpchannel) Risk to be tightly coupled to database schema 39

Data Carrier Options Typed Datasets n Pros n n n Disconnected model Designer to Data Carrier Options Typed Datasets n Pros n n n Disconnected model Designer to build XSD’s Even better databinding Design time type checking Intellisense + readability of code Cons n n n Deployment, versioning Diffgrams Overhead (8 – 10% slower) Support in Compact Framework Risk to be tightly coupled to database schema 40

Data Carrier Options True XML n Pros n n n Standard Flexible Cons n Data Carrier Options True XML n Pros n n n Standard Flexible Cons n n Little Semantics Custom XML Manipulation 41

Data Carrier Options Collections n Pros n n OO Portable Can databind if collection Data Carrier Options Collections n Pros n n OO Portable Can databind if collection implements IBinding. List Cons n n Code code Performance 42

Agenda n n A usecase driven approach From Use Case to data model to Agenda n n A usecase driven approach From Use Case to data model to physical database design Demo Choices to make up front n n n Type of client Partitioning of the application Host for the middle tier Data carrier Conclusions 43

Conclusions n n n It’s better to use UML than not to use it Conclusions n n n It’s better to use UML than not to use it Starting with Use Cases makes sense Make important choices upfront n n Deployment Security 44

Resources n n n In the pack you receive at the end of the Resources n n n In the pack you receive at the end of the day Post-event CD http: //www. football 247. net Football 247. Net Workspace on http: //www. gotdotnet. com http: //www. rational. com/UML/ Building Secure ASP. NET Solutions http: //www. microsoft. com/downloads/release. asp? Release ID=44047 45

© 2002 Microsoft Corporation. All rights reserved. 46 © 2002 Microsoft Corporation. All rights reserved. 46