Download
architecture and design and a touch of implementation for net n.
Skip this Video
Loading SlideShow in 5 Seconds..
Architecture and Design (and a touch of implementation) for .NET PowerPoint Presentation
Download Presentation
Architecture and Design (and a touch of implementation) for .NET

Architecture and Design (and a touch of implementation) for .NET

339 Vues Download Presentation
Télécharger la présentation

Architecture and Design (and a touch of implementation) for .NET

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Architecture and Design (and a touch of implementation)for .NET Keith Pleaskeithp@guideddesign.com

  2. Agenda • Motivation • An Architectural Framework • Where Design Patterns fit it • Microsoft’s Patterns & Practices • Microsoft’s Application Blocks • What this means to you

  3. Problem Statement • Unsuccessful IT projects - CIO Survey • 73% of IT projects considered failures • Not on time or budget, don’t meet requirements • 50% of time considered “churn time” • Unproductive time, not directly related to deliverable • Lack of standard target architectures • Disconnect between dev and operations

  4. Goals Of Architecture:The Customer Perspective • To let the business missions, strategies, and processes guide the use of information technology • To allow for the rapid adoption of new technologies for the competitive advantage of the enterprise • To provide for the rapid development and deployment of customized solutions • To enable repeatable, predictable, maintainable results

  5. Why Should You Care? • The computing industry is maturing • Maturity leads to commoditization • Commoditization pushes down the stack to the lowest cost producer • To stay ahead, must add value that’s difficult to commoditize

  6. Can We Learn From Other Industries? • Architecture from other domains • Physical architecture • Manufacturing • Bottom line: We have no “protection”

  7. Architectural Framework

  8. Relating Theories Zachman • Data • Application • Deployment • Infrastructure B - A - I - T D- A - D - I Layers • Business • Application • Information • Technical

  9. Architectural Framework

  10. Business Architecture

  11. Information Architecture

  12. Technology Architecture

  13. Application Architecture

  14. Design Patterns

  15. What Is A Pattern? Context Problem Solution

  16. Patterns • Provide reuse and repeatability • Design and Architectural • eCommerce Application • Model-View-Controller (MVC) • Fiefdoms / Emissaries • Data Access Layer • Class Factory • N-tier Design

  17. Singleton Pattern • Context: • Control access to a class by controlling its instantiation process • Problem: • Certain types of data need to be globally accessed and maintained • This data is often unique in the system • E.G. counter class

  18. Singleton Pattern • Solution:

  19. Singleton Pattern • Solution: public class Counter { private static Counter _instance = null; private Counter() {} public static Counter getInstance() { if (_instance==null) { _instance = new Counter(); } return _instance; } //... functions provided by Counter }

  20. Layered Architecture Pattern • Context: • You are designing a complex enterprise application composed of a large number of components across multiple levels of abstraction • Problem: • How do you structure an application to support such operational requirements such as maintainability, reusability, scalability, robustness and security?

  21. Layered Architecture Pattern • Forces: • Changes in one part of the app should have minimal impact to other parts • Separation of concerns is desirable • Portions of the app should be reusable • Strong cohesion, loose coupling is desired • Portions of the app will be maintained and evolved independently

  22. Layered Architecture Pattern • Solution: • Compose the solution into a set of layers. Each layer should be cohesive and at roughly the same level of abstraction. Each layer should be loosely coupled to the layers underneath.

  23. Communication Operational Management Security Layered Architecture Pattern Users UI Components UI Process Components Service Interfaces Business Workflows Business Components Business Entities Data Access Components Service Agents Data Sources Services

  24. Command Pattern • A request object • Allows creating requests of unspecified application objects • Common examples • A request created by a menu item selection • A request that pastes text from the clipboard into a document • Execution macros

  25. Model-View-Controller Pattern • Separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes • Model - manages the behavior and data of the application domain, responds to requests for information about its state, and responds to instructions to change state. • View - manages the display. • Controller - interprets the user input, informing the model and/or the view to change as appropriate. Controller Model View

  26. M-V-C in ASP.NET • Separates the code, the presentation, and actions • Model – Code-behind • View - HTML • Controller – ASP.NET engine (page controller) Controller Model View

  27. Broker Pattern • Problem • How can you structure a distributed system so that application developers don’t have to concern themselves with the details of remote communication? • Forces • Distributed communication complexity • Deployment Flexibility • Specialized Skills • Solution • Use the Broker pattern to hide the implementation details of remote service invocation by encapsulating them into a layer other than the business component itself

  28. Broker (Continued) • Discussion Points • Location Transparency • Server Lookup • Broker as Intermediary • Security Concerns • Benefits • Separation of Concerns • Complexity Management • Flexibility • Liabilities • Performance

  29. MicrosoftPatterns & Practices

  30. Business Opportunities Technology Solutions Operational Execution ENVISION PLAN BUILD DEPY OPERATE • Reference Architectures • BusinessRequirements • Non-functional Requirements • Technical Constraints • IT System Scope • Reference Building Blocks • Little or No BusinessContext • Non-functional Requirements • Technical Constraints • Sub-System Level Scope • Operational Practices • Operational BestPractices • Instantiation of MOF Within Solution Context • Architecture / Design Guide • Sample Application • Templates • Build / Implement Guide • Source Code • Templates • DeploymentGuide • Templates • OperationalGuide • Templates patterns & practices Patterns & Practices:Product Model

  31. The Pattern Graph

  32. Constraining The Graph OLTP Object Oriented Layered Architecture Tiered Distribution

  33. Deployment Components Presentation Framework Pattern Clusters Security

  34. Web Presentation Cluster Design Intercepting Filter Page Cache MVC Page Controller Front Controller Implementation Implementing MVC with ASP.Net Implementing Page Cache with ASP.Net Implementing Intercepting Filter with ASP.Net Implementing Page Controller with ASP.Net Implementing Front Controller with ASP.Net

  35. Use the Page Controller pattern to accept input from the page request, invoke the requested actions on the model, and determine the correct view to use for the resulting page. Page Controller • How do you best structure the controller for moderately complex Web applications so that you can achieve reuse and flexibility while avoiding code duplication? • MVCfocuses primarily on the separation between model and view • Many dynamic Web pages involve similar steps: verifying user authentication, extracting query string parameters etc. • Testing user interface code is time-consuming

  36. Implementing Page Controller in ASP.NET • Benefits • Simplicity • Leverages Frameworkfeatures • Increased reuse • Liabilities • One controller per page • Deep inheritance trees

  37. Front Controller solves the decentralization problem present in Page Controller by channeling all requests through a single controller. Front Controller • How do you best structure the controller for very complex Web applications so that you can achieve reuse and flexibility while avoiding code duplication? • Page controller can lead to overburdened base classes • Inheritance hierarchy is static • Might need to coordinate processes across pages • Might deal with dynamic navigation paths, e.g. a ‘Wizard’ that includes optional pages

  38. The Deployment Problem

  39. Deployment Cluster Deployment Application Infrastructure Tiered Distribution Layered Application Deployment Rich Client DNA .Net App IDC EDC DDC Ext. Ent Rich Client Complex Web Simple Web

  40. Web Clients Web Farm Web Farm UIC SI UIC UIP UIP SA Application Farm Application Farm BC BC DAC DAC Database Clusters Database Clusters Deployment Patterns Ent. Smart Client Extended Enterprise Simple Web App Complex Web App Web Clients Web Clients Smart Clients UIC UIP Web Farm Web Farm UIC SI SA UIP BC Application Farm DAC BC DAC Database Clusters Database Clusters

  41. Deployment Cluster Deployment Application Infrastructure Business Component Clustering Zone Policies Load Balancing Entity Process Utility Failover Policy Store PEP Software Hardware

  42. MicrosoftApplication Blocks

  43. EULA and Support Model • Source Code only – VB.NET and C# • No binaries - ‘As is’ EULA • Customizations OK • Redistribution & repackaging OK • Support • PSS sign-off • PSS Training • Consistency in recommendations • Escalation procedures, bug reporting • GotDotNet Community

  44. Application Blocks for .NET Sample App – E-Commerce Application Presentation Services Communication Security Operational Management User Interface Process (UIP) Exception Mgmt Caching Enterprise Instrumentation Business Services Configuration Data Aggregation Data Services Service Integration Application Authorization Data Access (SQL, plan: Oracle, OleDB) Persistent Asynchronous Invocation Data Sources Services Operational Guides Team Dev – Build Scripts (Partner) Shipped In Beta In Development

  45. Data Access Application Block • Simplifies calling ADO.NET SqlClient • Simplifies returning many formats • Get DataSets, DataReaders, Scalars, XmlReaders – all in one line of code • Simplifies calling with many sources • Connections, Conn. Strings, SQL Transactions • Plays well with COM+ • Best practices performance • Nile benchmarks (internal & competitive) dr = SqlHelper.ExecuteReader( CONN_STRING,“SaveCustomer", “John” , “Doe” );

  46. Data Access Application Block

  47. Choosing a DAAB Method • Then choose target data source • Connection String • SqlConnection • SqlTransaction • First, choose the response format • Int • DataSet • SqlDataReader • Object • XmlReader • …and finally, what type of parameters you want to send • Value Array • SqlParameter Arrays • No Parameters SqlHelper SqlHelper.ExecuteDataset( SqlHelper.ExecuteDataset(“connectionstring” SqlHelper.ExecuteDataset(“connectionstring”, CommandType.StoredProcedure, ”CustomersGetByPlanet”, “Earth”);

  48. demo Data Access Application Block

  49. Data Access Application Block • Parameter Caching • Caches Stored Procedure Parameters • Avoids 2 roundtrips • Cache can be loaded manually (enforcing type manually) or automatically ‘on the fly’ • Important Links • .NET Data Access Architecture Guidehttp://msdn.microsoft.com/library/en-us/dnbda/html/daag.asp • GotDotNet Workspace • http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=c20d12b0-af52-402b-9b7c-aaeb21d1f431

  50. DAAB Tips • ‘Privatize’ functions you don’t need • Things you can add • Connection String Mgmt • Batch Updates* • Typed Datasets* • * Next rev • Instrumentation, etc.