net architecture for enterprises

Post on 10-May-2015

2.678 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

.NET Architecturefor Enterprises

Wade WegnerArchitect, Microsoft Corporationwade.wegner@microsoft.comhttp://www.architectingwith.net/

First, a story …

First, a story …personal^

There once was a developer …

… who really enjoyed coding …

.NET

Python

JavaScript

HTML

Web Services

BizTalk

Tibco

SQL Server

OracleAS/400

Window Server

Apache

IIS

SOA

… and then one day …

… through no fault of his own …

… someone called him an architect.

How did this happen?

Was he suddenly adifferent person?

Did he now need to careabout different things?

Goals

Leave with a better understandingof architecture

Goals

Leave with a better understandingof architecture

Goals

software^

Understand the practical aspectsof architecture in .NET

Goals

What is architecture?

Why should I care?

How is software architecturedifferent?

Determining how to do something

Making expensive andhard-to-change decisions

Who is the architect?

Are there different typesof architects?

Are architects project managers?

Should architects write code?

Do architects just focuson abstractions?

Poor software typicallyhas one of two causes …

… insufficient skills.

… contradictory and ambiguousrequirements.

Anyone can write codethat just works.

Our goal should be …

… to write good codethat works.

Why?

For poorly written code“that just works”…

… maintenance is expensive

… maintenance is frustrating

… maintenance is time consuming

How do we write good codethat works?

Tenets of Structured Design

Cohesion

Tenets of Structured Design

Coupling

Tenets of Structured Design

Low coupling &High cohesion

Tenets of Structured Design

Separation of Concerns

Identifying the concerns

Separation of Concerns

Modularity

Separation of Concerns

Information hiding

Separation of Concerns

So, what are some principles that make this easier?

Find Pertinent Objects First

Principles

Find Pertinent Objects First

Principles

To view all orders placed by a customer, the user indicates the customer ID. The program displays an error message if the customer does not exist. If the customer exists, the program displays name, address, date of birth, and all outstanding orders. For each order, the program gets ID, date, and all order items.

Favor Low Coupling

Principles

Favor Low Coupling

Principles

Program to an interface, not an implementation

Favor Code Reuse

Principles

This is great, we know this …so, what else is there?

Open/Closed Principle

Advanced Principles

Liskov’s Substitution Principle

Advanced Principles

Dependency Inversion Principle

Advanced Principles

Dependency Inversion Principle

Advanced Principles

public class Foo{

IDoSomething _doSomething = null;

public Foo(IDoSomething doSomething){

_doSomething = doSomething;}

}

Patterns

Design Patterns

Patterns

Architectural Patterns

Patterns

Antipatterns

Patterns

Patterns are not …

… a verb

Patterns are not …

… superhuman

Patterns are not …

… inherently good nor evil

Patterns are not …

Testability & Security

Testability

Software Testing

Testability

Software Contracts

Testability

Unit Testing

Testability

Dealing with Dependencies

Testability

Fakes to Mocks

Testability

Security

Security as a requirement

Security

Security Development Lifecycle

Security

Layering

Security Development Lifecycle

Componentization

Security Development Lifecycle

Roles

Security Development Lifecycle

Threat models

Security

Okay, is this it?

Interesting, but abstract

How does this help me design my system?

Let’s look at the common layers of any system …

The Business Layer

The Service Layer

The Data Access Layer

The Presentation Layer

The Business Layer

What is it?

The Business Layer

Domain’s Object Model

The Business Layer

Domain Entities

The Business Layer

Business Rules

The Business Layer

Validation

The Business Layer

Business Process & Workflow

The Business Layer

Where do you deploy it?

The Business Layer

The Gray Areas

The Business Layer

Data Formatting

The Business Layer – Gray Areas

CRUD

The Business Layer – Gray Areas

Stored Procedures

The Business Layer – Gray Areas

Patterns

The Business Layer

The Transaction Script Pattern

The Business Layer

The Table Module Pattern

The Business Layer

The Active Record Pattern

The Business Layer

The Domain Model Pattern

The Business Layer

The Service Layer

What is it?

The Service Layer

What’s service orientation?

The Service Layer

What about SOA?

Service-Oriented Architecture

The Services Layer

Tenets of SOA

The Services Layer

Boundaries Are Explicit

Tenets of SOA

Services Are Autonomous

Tenets of SOA

Use Contracts, Not Classes

Tenets of SOA

Compatibility Is Based on Policy

Tenets of SOA

What SOA is not …

… a revolution

SOA is not …

… a technology

SOA is not …

… a web service

SOA is not …

… a goal

SOA is not …

The Data Access Layer

What is it?

The Data Access Layer

Requirements

The Data Access Layer

Database Independence

DAL: Requirements

Configurable as a Plug-in

DAL: Requirements

Persisting the Application’sObject Model

DAL: Requirements

Responsibilities

The Data Access Layer

CRUD services

DAL: Responsibilities

Query services

DAL: Responsibilities

Transactions

DAL: Responsibilities

Concurrency

DAL: Responsibilities

Separated Interface Pattern

The Data Access Layer

The Plugin Pattern

The Data Access Layer

Should you write your own DAL?

The Data Access Layer

O/RMs

The Data Access Layer

Entity Framework

EntitySpaces

NHibernate

Genome

LINQ-to-SQL

LLBLGen Pro

Using an O/RM Tool

The Data Access Layer

Stored Procedures?

The Data Access Layer

SPs are faster than SQL code

DAL: Stored Procedure Myth #1

SPs are more secure than SQL code

DAL: Stored Procedure Myth #2

SPs can be used to fend off SQL injection

DAL: Stored Procedure Myth #3

SPs can be used to reduce brittleness of SQL code

DAL: Stored Procedure Myth #4

Stop! What are you saying?

Do we still need DBAs?

The Presentation Layer

Responsibilities

The Presentation Layer

Validation?Formatting?

Styling?Usability?

PL: Responsibilities

Independence from graphics

PL: Responsibilities

Independence from UI Technology

PL: Responsibilities

Testability

PL: Responsibilities

Independence from data model

PL: Responsibilities

Patterns

The Presentation Layer

Model-View-Controller (MVC)

PL: Patterns

Model-View-Presenter (MVP)

PL: Patterns

How do I choose a pattern?

The Presentation Layer

Summary

Defined Architecture

Summary

Described Architects

Summary

Maintainability

Summary

Low coupling & high cohesion

Summary

Principles of software architecture

Summary

Design patterns

Summary

Architecture patterns & antipatterns

Summary

Testability & Security

Summary

The Business Layer

Summary

The Services Layer

Summary

The Data Access Layer

Summary

The Presentation Layer

Summary

Closing thoughts …

“It” depends

Closing thoughts …

Requirements

Closing thoughts …

Reuse is a nice side effect

Closing thoughts …

Separation of Concerns

Closing thoughts …

Maintainability

Closing thoughts …

Don’t trust your users

Closing thoughts …

Security and testability by design

Closing thoughts …

© 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.

wade.wegner@microsoft.comhttp://architectingwith.net

top related