Http://msdn.com/practices. john devadoss product unit manager, patterns & practices...

Preview:

Citation preview

http://msdn.com/practices

an introduction to the application architecture guide

john devadossproduct unit manager, patterns & practices

johnd@microsoft.comDPR 301

What is Architecture?

Pop Quiz

Agenda

A Lap around the Application Architecture Guide v2

Architecture Hot Spots

Using the Application Architecture Guide in the Real World

Discussion

Walk-through/demo

Ray Ozzie on the Application Architecture Guide 2.0…

“This guide is a tremendous compilation of patterns, practices, architectural styles and other principles to be used when structuring a contemporary .NET application”

“Whether developing software targeted at the PC or a phone; or developing services for the web or an enterprise server; or developing a composite software + services solution, this book will provide you a wealth of useful and practical guidance.”

Grady Booch on the Application Architecture Guide 2.0…

Architecture is About Significant DecisionsI find this work to be very interesting (and useful). Architecture is all about making significant design decisions, and this guide focuses on a number of such decision points, including caching, communication, concurrency and transactions, configuration management, coupling and cohesion, data access, exception management, layering, logging and instrumentation, state management, structure, validation, and workflow (collectively, Microsoft calls these "architectural frames").

A Language for ApplicationsFull of best practices and patterns, I particularly liked the enumeration of architectural styles the authors have collected: client-server, component-based, layered, message-bus, model-view-controller, n-tier, object-oriented, and service-oriented. Congruent with these styles is their concept of application archetypes, which include mobile, rich client, rich internet, services, and web. Combine the these styles and archetypes, and you have an interesting language for describing a large class of applications.

5 Key Usage Scenarios for the Guide

1. Choose the right architecture for your application

2. Choose the right technologies

3. Make more effective choices for key engineering decisions

4. Map appropriate application patterns

5. Use relevant patterns & practices solution assets

5 Key Focus Areas of the Guide1. Canonical Application Frame

2. Application Types

3. Architecture Frame

4. Quality Attributes

5. Technologies and capabilities

1. Canonical Frame

Arch StylesSets of principles that shape the application

Architectural EvolutionMonolithic -> Client-Server -> 3-Tier -> N-Tier ->

Components -> Services

2. Application Types (Archetypes)Not Exhaustive, Illustrative

Web Application

Rich Internet Application (RIA)

Service

Application type Benefits Considerations

Mobile Applications Support for handheld devices

Input and navigation limitations

Availability and ease of use for out Limited screen display area

Support for offline and occasionally

Rich client applications Ability to leverage client resources

Deployment complexity; however, a range of installation options such as ClickOnce, Windows Installer and XCOPY are available

Better responsiveness, rich UI functionality, and improved user experience

Challenging to version over time

Highly dynamic and responsive interaction Platform-specific

Support for offline and occasionally connected applications

Rich Internet applications (RIA)

The same rich user interface capability as rich clients

Larger application footprint on the client machine compared to a Web application

Support for rich media and graphic display

Restrictions on leveraging client resources compared to a rich client application

Simple deployment and the distribution capabilities (reach) of Web clients

Requirement for deployment of the .NET or Microsoft Silverlight™ run time on the client

Simple upgrade and version updatingCross-platform and cross-browser support

Service applicationsLoosely coupled interactions between client and server

No UI support

Ability to be consumed by different and unrelated applications

Dependent on network connectivity

Support for interoperability

Web applicationsBroad reach, and a standards-based UI across multiple platforms

Dependent on continual network connectivity

Ease of deployment and change management

Difficulty in providing a rich user interface

Application Type Considerations

3. Architecture Frame

Web Application

Design ConsiderationsPartition your application logicallyUse abstraction to implement loose coupling between layersUnderstand how components will communicate with each otherReduce round tripsConsider using cachingConsider using logging and instrumentationAvoid blocking during long-running tasks boundariesConsider authenticating users across trust boundariesDo not pass sensitive data in plain text across the networkDesign your Web application to run using a least-privileged account

Web Application FrameCategory Key issuesAuthentication Lack of authentication across trust boundaries

Storing passwords in a database as plain textDesigning custom authentication mechanism instead of using built-in capabilities

Authorization Lack of authorization across trust boundariesIncorrect role granularityUsing impersonation and delegation when not required

Caching Caching volatile dataNot considering caching page outputCaching sensitive dataFailing to cache data in a ready-to-use format

Exception Management Revealing sensitive information to the end user

Not logging sufficient details about the exception

Using exceptions to control application flow

Logging and Instrumentation

Failing to implement adequate instrumentation in all layersFailing to log system-critical and business-critical eventsNot supporting run-time configuration of logging and instrumentation

Pattern MapCategory Relevant patternsCaching Cache Dependency

Page CacheException Management Exception ShieldingLogging and Instrumentation Provider

Navigation Model-View-PresenterModel-View-Controller

Page Layout (UI) Template ViewComposite ViewTransform ViewTwo-Step View

Request Processing Intercepting Filter

Page Controller

Front Controller

Passive View

Supervising Controller

Service Interface Layer Façade

Service Interface

4. Quality Attributes

Quality AttributesType Quality attributesSystem Qualities Supportability

TestabilityRun-time Qualities Availability

InteroperabilityManageabilityPerformanceReliabilityScalabilitySecurity

Design Qualities Conceptual IntegrityFlexibilityMaintainabilityReusability

User Qualities User Experience / Usability

Quality Attribute FrameQuality attribute Description

Availability

Availability defines the proportion of time that the system is functional and working. It can be measured as a percentage of the total system downtime over a predefined period. Availability will be affected by system errors, infrastructure problems, malicious attacks, and system load.

Conceptual Integrity

Conceptual integrity defines the consistency and coherence of the overall design. This includes the way that components or modules are designed, as well as factors such as coding style and variable naming.

Flexibility

Flexibility is the ability of a system to adapt to varying environments and situations, and to cope with changes in business policies and rules. A flexible system is one that is easy to reconfigure or adapt in response to different user and system requirements.

Interoperability

Interoperability is the ability of diverse components of a system or different systems to operate successfully by exchanging information, often by using services. An interoperable system makes it easier to exchange and reuse information internally as well as externally.

MaintainabilityMaintainability is the ability of a system to undergo changes to its components, services, features, and interfaces as may be required when adding or changing the functionality, fixing errors, and meeting new business requirements.

ManageabilityManageability defines how easy it is to manage the application, usually through sufficient and useful instrumentation exposed for use in monitoring systems and for debugging and performance tuning.

Performance

Performance is an indication of the responsiveness of a system to execute any action within a given time interval. It can be measured in terms of latency or throughput. Latency is the time taken to respond to any event. Throughput is the number of events that take place within a given amount of time.

ReliabilityReliability is the ability of a system to remain operational over time. Reliability is measured as the probability that a system will not fail to perform its intended functions over a specified time interval.

ReusabilityReusability defines the capability for components and subsystems to be suitable for use in other applications and in other scenarios. Reusability minimizes the duplication of components and also the implementation time.

ScalabilityScalability is the ability of a system to function well when there are changes to the load or demand. Typically, the system will be able to be extended over more powerful or more numerous servers as demand and load increase.

SecuritySecurity defines the ways that a system is protected from disclosure or loss of information, and the possibility of a successful malicious attack. A secure system aims to protect assets and prevent unauthorized modification of information.

SupportabilitySupportability defines how easy it is for operators, developers, and users to understand and use the application, and how easy it is to resolve errors when the system fails to work correctly.

Testability

Testability is a measure of how easy it is to create test criteria for the system and its components, and to execute these tests in order to determine if the criteria are met. Good testability makes it more likely that faults in a system can be isolated in a timely and effective manner.

UsabilityUsability defines how well the application meets the requirements of the user and consumer by being intuitive, easy to localize and globalize, and able to provide good access for disabled users and a good overall user experience.

5.Technologies and Capabilities

Rich Client ApplicationsTechnology Benefits Considerations

Windows FormsHas a familiar programming model.

Does not support 3-D graphics, streaming media, flowable text, and other advanced UI features in WPF such as UI styling and templates.

Has Visual Studio Designer support. Must be installed on the client.

Offers good performance on a wide range of client hardware.

Windows Forms with WPF User Controls

Allows you to add rich UI to existing Windows Forms applications.

Depending on the complexity of your UI, it may require higher-powered graphics hardware.

Provides a transition strategy to full WPF applications.

You cannot overlay Windows Forms and WPF controls, reducing visual design flexibility.

WPF application

Provides rich UI and visualization including 2-D and 3-D graphics, display resolution independence, vector graphics, flowable text, and animation.

Depending on the complexity of your UI, it may require higher-powered graphics hardware.

Supports variable-bandwidth streaming media (Adaptive Media Streaming).

Your team may be less familiar with Expression Blend compared to Visual Studio.

XAML makes it easier to define the UI, data-binding, and events.

WPF ships with fewer built-in controls than Windows Forms.

Supports separate developer/graphic designer integration.

WPF with Windows Forms Controls

Allows you to supplement WPF with controls that are not provided by WFP; for example, WPF does not provide a grid control.

Requires a WindowsFormsHost.

It may be difficult to get focus and input to transition across boundaries.You cannot overlap WPF and Windows Forms controls.WPF and Windows Forms controls use different rendering techniques, which can cause inconsistencies in how they look on different platforms.

XAML Browser Application (XBAP) using WPF

Allows you to deploy a WPF application to the Web.

Only works on Vista or on a client with .NET Framework 3.5 and the XBAP browser plug-in installed.

Provides all the rich visualization and UI benefits of WPF.

Only works in Internet Explorer and Mozilla Firefox browsers.

Is easier to deploy and update than a WPF or Windows Forms application.

5 Key Features of the Guide1. Canonical Application Frame

2. Application Types

3. Architecture Frame

4. Quality Attributes

5. Technologies and capabilities

Hot Spots

Filter Failure

“What we're dealing with now is not the problem of information overload, because we're always dealing (and always have been dealing) with

information overload...thinking about information overload isn't accurately

describing the problem; thinking about filter failure is.”

Clay Shirky, New York University New-media Professor, Writer, and Consultant

Architecture Hot Spots Are the FiltersLenses

FocusSignificance

If you don’t know what you’re looking for …

… you’re not going to see it

Hot Spots for Architecture

Hot Spots for Web Applications

Hot Spots for Security

If you know what you’re looking for, you can find it

Hot Spots for Performance

If you know what you’re looking for, you can find it

http://apparchguide.codeplex.com/walkthrough/demo

Using the Application Architecture Guide in the Real World

ApproachStep 1. Identify Objectives. Step 2. Key Scenarios.

Architecturally Significant Use Cases

Step 3. Application Overview.Application TypeDeploymentArchitecture StylesTechnologies

Step 4. Key Hot Spots. Architecturally Significant Use CasesQuality AttributesArch Frame

Step 5. Candidate Solutions.Baseline / Candidate ArchitecturesArchitectural Spikes

Step 1.Identify Objectives

Step 1. Identify Objectives

Scope and TimeWhat’s the scopeHow much time

Purpose and Priorities Building prototypes Identifying key technical risks Testing potential paths Sharing models and understanding

Step 2. Key Scenarios

Step 2. Key Scenarios

Architecturally significant use cases.Intersection of quality attributes with functionality (e.g. authentication)Intersection of cross-cutting concerns (e.g. security impact on performance)

User stories, business stories, AND system stories

Step 3. Application Overview

Step 3. Application Overview

Key PartsApplication TypeDeploymentArchitecture StylesTechnologies

Be Able to Whiteboard It

Choosing Application TypesApplication Type

Benefits Considerations

Mobile Can support handheld devices Availability and ease of use for out-of-office users Can support offline and occasionally-connected applications

Input and navigation limitations Limited screen display area

Rich Client Applications

Can leverage client resources Provide better responsiveness, rich UI functionality, and improved user experience Highly dynamic and responsive interaction Can support offline and occasionally-connected applications

Deployment complexity. Can be challenging to version over timePlatform-specific

Rich Internet Applications (RIA)

Provide the same rich user interface capability as Rich Clients Provide support for rich media and graphic display Simple deployment and the distribution capabilities (reach) of Web clients

Larger application footprint on the client machine compared to a Web application Restrictions on leveraging client resources compared to a Rich Client application Requires the deployment of the .NET or Silverlight runtime on the client

Services Application

Provide loosely coupled interactions between client and server Can be consumed by different and unrelated applications Supports interoperability

No UI support Client is dependent on network connectivity

Web Application

Broad reach, and a standards-based UI across multiple platforms Ease of deployment and change management

Application is dependent on network connectivity Providing a rich user interface is difficult

Deployment PatternsNon-distributed

Distributed

Web/App Farms

Work back from the end in mind!

Architectural StylesSets of principles that shape the application.

Applications are a Mash Up of Arch Styles ... Not Mutually Exclusive

Technologies

In a mature market, expect lots of options and specialization

When You Choose Candidate App Types, You Slice/Dice Your Options Down

Rich Client

Web Applications

Step 4. Key Hot Spots

Step 4. Key Hot Spots

Architecture Hot SpotsQuality Hot Spots

If you don’t know what you’re looking for … … you’re not going to see it

Hot spots are the filters.

Hot Spots for Architecture

Hot Spots for Security

If you know what you’re looking for, you can find it.

Hot Spots for Performance

If you know what you’re looking for, you can find it.

Step 5. Candidate Solutions

Step 5. Candidate Solutions

OutcomesBaseline / Candidate ArchitecturesArchitectural Spikes

IterativeIncremental

ApproachStep 1. Identify Objectives. Step 2. Key Scenarios.

Architecturally Significant Use Cases

Step 3. Application Overview.Application TypeDeploymentArchitecture StylesTechnologies

Step 4. Key Hot Spots. Architecturally Significant Use CasesQuality AttributesArch Frame

Step 5. Candidate Solutions.Baseline / Candidate ArchitecturesArchitectural Spikes

Recap

A Lap around the Application Architecture Guide v2

Architecture Hot Spots

Using the Application Architecture Guide in the Real World

Discussion

Walk-through/demo

http://apparchguide.codeplex.com/

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,

IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Recommended