Architecture and Design and a touch of implementation for 'NET - PowerPoint PPT Presentation

1 / 69
About This Presentation
Title:

Architecture and Design and a touch of implementation for 'NET

Description:

50% of time considered 'churn time' Unproductive time, not directly ... complex enterprise application composed of a large ... Compose the solution ... – PowerPoint PPT presentation

Number of Views:84
Avg rating:3.0/5.0
Slides: 70
Provided by: keith73
Category:

less

Transcript and Presenter's Notes

Title: Architecture and Design and a touch of implementation for 'NET


1
Architecture and Design (and a touch of
implementation)for .NET
Keith Pleaskeithp_at_guideddesign.com
2
Agenda
  • Motivation
  • An Architectural Framework
  • Where Design Patterns fit it
  • Microsofts Patterns Practices
  • Microsofts 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, dont 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 ArchitectureThe 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 thats 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
(_instancenull) _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
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 dont 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
Patterns PracticesProduct Model
31
The Pattern Graph
32
Constraining The Graph
OLTP
Object Oriented
Layered Architecture
Tiered Distribution
33
Pattern Clusters
Security
34
Web Presentation Cluster
Design
Intercepting Filter
Page Cache
MVC
Front Controller
Page Controller
Implementation
Implementing MVC with ASP.Net
Implementing Page Cache with ASP.Net
Implementing Intercepting Filter with ASP.Net
Implementing Front Controller with ASP.Net
Implementing Page Controller with ASP.Net
35
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?
  • MVC focuses 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
  • 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
Deployment Patterns
Simple Web App
Complex Web App
Ent. Smart Client
Extended Enterprise
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
Presentation Services
Operational Management
Security
Communication
Sample App E-Commerce Application
User Interface Process (UIP)
Exception Mgmt
Caching
Enterprise Instrumentation
Business Services
Configuration
Data Aggregation
Service Integration
Data Services
Application Authorization
Persistent Asynchronous Invocation
Data Access (SQL, plan Oracle, OleDB)
Services
Data Sources
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, CustomersGetByPlan
et, Earth)
48
Data Access Application Block
demo
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.mi
    crosoft.com/library/en-us/dnbda/html/daag.asp
  • GotDotNet Workspace
  • http//www.gotdotnet.com/Community/Workspaces/Work
    space.aspx?idc20d12b0-af52-402b-9b7c-aaeb21d1f431

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

51
ExceptionManager
  • Simplifies managing Exceptions
  • Pluggable Publishers of exception info
  • Event Log as default.
  • Filters for routing / verbosity
  • Adds troubleshooting information
  • Persists Exception Chain
  • Plans to extend with Enterprise Instrumentation Fx

try catch( Exception ex )
ExceptionManager.Publish (ex )
52
Exception Management
53
Exception Mgmt App Block
  • Runtime flexibility, pluggable design

ltconfigurationgt ltconfigSectionsgt ltsection
name"exceptionManagement" type"
Microsoft.ApplicationBlocks.ExceptionManagement .
ExceptionManagerSectionHandler, Microsoft.Applica
tionBlocks.ExceptionManagement" /gt
lt/configSectionsgt ltexceptionManagement
mode"on/off"gt ltpublisher mode"on/off"
assembly"AssemblyName"
type"TypeName" excludeType,Type"
includeType,Type"
exceptionFormat"xml" customattr "value" /gt
lt/exceptionManagementgt lt/configurationgt
54
User Interface Process Block
  • Facilitates developing complex UI control
  • Helps you implement the MVC pattern
  • Describe your UI flow as XML
  • Reuse controller logic for Windows Web
  • Take care of state management
  • Start, pause and resume user tasks without having
    your code notice

55
A User Interface Process
  • A User Interface Process represents a use case
  • You can draw it as a flow between views
  • The UIP Block uses XML config to manage flow

ltnavigationGraph iViewManager"WinFormViewManager
" name"Shopping" state"State"
statePersist"SqlServerPersistState" startView"c
art"gt ltnode view"cart"gt ltnavigateTo
navigateValue"resume" view"browsecatalog"
/gt ltnavigateTo navigateValue"checkout"
view"checkout" /gt ltnavigateTo navigateValue"fail
" view"error" /gt lt/nodegt ltnode
view"browsecatalog"gt ltnavigateTo
navigateValue"addItem" view"cart"/gt ltnavigateTo
navigateValue"fail" view"error"
/gt lt/nodegt ltnode view"error"gt ltnavigateTo
navigateValue"resume" view"cart"
/gt lt/nodegt ltnode view"checkout"gt ltnavigateTo
navigateValue"passCheckout" view"congrats"
/gt ltnavigateTo navigateValue"failCheckout"
view"checkout" /gt lt/nodegt ltnode
view"congratulations"gt ltnavigateTo
navigateValue"resume" view"cart"
/gt lt/nodegt lt/navigationGraphgt
browsecatalog
addItem
fail
resume
ltnode view"browsecatalog"gt ltnavigateTo
navigateValue"addItem" view"cart"/gt ltnavigateTo
navigateValue"fail" view"error" /gt lt/nodegt
congrats
error
resume
resume
fail
passCheckout
cart
checkout
checkout
failCheckout
56
UIP In Your Application
Your ASP.NET Pages
WebFormView
ControllerBase
Persistence Providers - SQL Server - Encrypted
SQL Server - Memory - ASP.NET Session - Custom
Your Controller Class
State Persistence Provider
MyFunc() //do cool code //more good
stuff
Biz Components
Biz Components
DALC
DALC
Data Access
57
UIP Code
  • Writing Controllers
  • Inherit your class from ControllerBase
  • Use the State object to hold your process data
  • Use the NavigateValue property to set your output
  • Interact with your business layers
  • Writing Views
  • Inherit your page from WebFormView
  • Inherit your Form from WinFormView
  • Use the MyController property to access the
    controller
  • UIP sets the reference for you

58
User Interface Process Block
demo
59
Configuration Management AB
  • Secure configuration in multiple sources
  • Helps maintain application configuration
  • Pluggable Storage
  • Pluggable Signing Encryption
  • Caching of config data for performance

60
Using the Config Management AB
  • Write your application as usual
  • Specify config for the config
  • Where config section stored, encrypted or not,
    caching policy
  • Includes utilities QuickStarts for encryption

ltconfigSection nameYourAppConfigSection"gt
ltconfigProvider assembly"Microsoft.ApplicationB
locks.ConfigurationManagement.Storage.XML, Versio
n1.0.0.4,Cultureneutral, PublicKeyToken3325ee11
de9ffa0a" type"Microsoft.ApplicationBlocks.Conf
igurationManagement.Storage.XmlFileStorage"
signed"false" refreshOnChange"true"
encrypted"false" /gt ltconfigCache
enabled"true" locationPath""
locationType"Memory" refresh"1 "
signed"true" encryptedfalse"
/gt lt/configSectiongt
61
Configuration Mgmt Design
Configuration Manager
Caching Service
Your Application
Application XML Configuration File (holds config
for config)
Configuration Storage Providers - XML File -
SQL Server - Registry - Custom
Configuration Section Handlers
Configuration Section Handlers
Configuration Section Handlers
Data Protection Providers - DPAPI - BCL - Custom
62
Updater Application Block
  • V Next of the popular GotDotNet Application
    Updater
  • Securely pull assemblies and files
  • Pluggable download mechanism
  • Includes BITS - Background Intelligent Transfer
    System
  • Run custom actions post deployment
  • Downloads validated using RSA or custom validation

63
Using the Updater AB
Poll Download
Application Update
Update Controller (Application or separate EXE)
Updater Application Block
Controller XML Configuration File
File Copy
Manifest
Application
64
Upcoming Application Blocks
  • Other blocks in development
  • Caching, Asynch Invocation, Aggregation
  • Available July
  • Get beta blocks on GotDotNet workspaces
  • Get the code
  • Get samples
  • Get extra plug-ins

65
Summary
  • Where are we in the cycle?
  • Where do you fit in?
  • Where should you make your investment?

66
References
  • A Pattern Language Towns/ Buildings/
    Construction Alexander (1977)
  • Design Patterns Elements of Reusable
    Object-Oriented Software Gamma, et al (1995)
  • Pattern-Oriented Software Architecture A System
    of Patterns (1996)
  • Pattern-Oriented Software Architecture Volume 2
    Patterns for Concurrent and Networked Objects
    (2000)
  • Patterns of Enterprise Application Architecture
    Fowler (2003)
  • AntiPatterns Brown, et al (1998)

67
MSDN Architecture Webcasts
  • Architecting applications to leverage existing
    code
  • VS.NET Enterprise Architect
  • XML Web Services inside Microsoft
  • The role of virtualization in XML Web Services
  • J2EE the .NET Platform within the Software
    Fortress
  • Microsoft TerraServer Architecture
  • Autonomous Computing Fiefdoms and Emissaries
  • Building Interoperable Web Services
  • .NET Interoperability with J2EE
  • Architecting Interoperable Web Services using .NET

68
MSDN Architecture Webcasts
  • Design choices performance in distributed .NET
    apps
  • Some architectural patterns for the enterprise
  • Architecting a .NET distributed application
  • ASP.NET Mobilizing Your Desktop Web Applications
  • .Net and J2EE interoperability
  • SQLXML XML Technology for SQL Server
  • XML Web Services Security
  • Legacy Enterprise Application Integration
  • ASP.NET Patterns and Idioms
  • An overview of Architecture
  • .Net and J2EE interoperability update
  • .NET Architecture Center Overview

69
MSDN Architecture Webcasts
  • The Future of XML Web Services
  • Networking in the Microsoft Systems Architecture
  • An Overview of Microsoft Systems Architecture
  • Customizing the Microsoft Systems Architecture
  • Security in the Microsoft Systems Architecture
  • Web Service Architecture - Deciphering WS-
    protocol
  • Using Patterns to Build Business Applications
  • Distributed LOB app design using Application
    Blocks
Write a Comment
User Comments (0)
About PowerShow.com