47

Overview of VS2010 and .NET 4.0

Embed Size (px)

DESCRIPTION

This slide deck was used at the ObjectSharp At The Movies event as an overview of the new features of VS2010 and functionality added to .NET 4.0

Citation preview

Page 1: Overview of VS2010 and .NET 4.0
Page 2: Overview of VS2010 and .NET 4.0

An Overview of VS2010 and .NET 4.0

Page 3: Overview of VS2010 and .NET 4.0

Visual Studio Targets Many…

Audience

Feat

ure

Set

Minimal

Complete

Hobbyist Enterprise

Professional

Team System

Express

Page 4: Overview of VS2010 and .NET 4.0

…and there are Four Pillars

Understanding The Code

Building WebApplications

Creating OfficeBusiness

Applications

Using ThePower of

C++

Page 5: Overview of VS2010 and .NET 4.0

New Look & Feel

Web Deploy

web.config Transformation

Call Hierarchy

Inline Call Tree

Highlight References

Document Map Margin

Extensible Test Runner

WPF-based Editor

Sharepoint Tooling

JQueryIntellisense

HTML Snippets

Historical Debugging

Concurrency Profiler

Parallel Tasks Window

Parallel Stacks Window

Quick Search

Generate From Usage

Improved Multi-Monitor

MVC Tooling

Dynamic Data Tooling

Click-Once Enhancements for Office

64-bit Mixed-Mode

Minidump Debugging

Breakpoint Grouping

Breakpoint Labeling

Breakpoint Import/Export

Improved WPF Tooling

New Visual Studio 2010 Features…

Page 6: Overview of VS2010 and .NET 4.0

The Two Faces of Visual Studio 2010

Visual Studio As An Editor

An improved focus on… Writing code,

Understanding code,Navigating code,Publishing code

Page 7: Overview of VS2010 and .NET 4.0

NEW VS2010 CAPABILITIES

Page 8: Overview of VS2010 and .NET 4.0

The Two Faces of Visual Studio 2010

Visual Studio As A Platform

New Editor allows for easy extensibility to provide a rich and robust editing experience

Online Visual Studio Gallery integrated directly into Visual Studio

Page 9: Overview of VS2010 and .NET 4.0

Extension Manager

Page 10: Overview of VS2010 and .NET 4.0

But Didn’t You Say Extensibility?

• Available through the Managed Extensibility Framework (MEF)– New library in the .NET Framework– Enables greater reuse of applications and

components. • Shift applications from being statically to

dynamically composed

Page 11: Overview of VS2010 and .NET 4.0

Composite Application?

• Isn’t that like Prism?– Sort of

• MEF != Prism– Prism is just UI guidance– Uses an IoC container (Unity)

• MEF is a dependency injection framework– Closer to Unity– Can actually be used with Prism

Page 12: Overview of VS2010 and .NET 4.0

Applications Made Out of Parts

Page 13: Overview of VS2010 and .NET 4.0

The Import/Export Business

Export

Import

Got

Need

Parts

Page 14: Overview of VS2010 and .NET 4.0

The Extensibility Scenario

Application

Extension A

Extension B

Need Menus

Got a Menu

Need a Toolwindow

Need a MenuService

Got a Toolwindow

Got a MenuService

Page 15: Overview of VS2010 and .NET 4.0

…Put into Geek Terms

Part

Part Part

ImportMenus

Export aMenu

Import “Toolwindow”

Export IMenuService

Export “Toolwindow”

Import IMenuService

Page 16: Overview of VS2010 and .NET 4.0

And Why Should I Care?

• Because the Visual Studio 2010 IDE is a MEF application– Integration with menus– Integration with toolbars– Integration with the editor

Page 17: Overview of VS2010 and .NET 4.0

EXTENDING VISUAL STUDIO

Page 18: Overview of VS2010 and .NET 4.0

The Target of CLR 4

• Working Better Together…

In-Proc SxS

Native/Managed InteropDLR Integration

Managed Extensibility Framework

Threading Parallel Extensions

Garbage Collection Profiling

Code Contracts DebuggingCorrupted State Exceptions

Faster

With Fewer Bugs…

Working Better Together…

Page 19: Overview of VS2010 and .NET 4.0

Side-by-Side (Sxs) at .NET 3.5

.NET 2.0

2.0 add-in

3.0

3.5

Host Process (i.e. Outlook)

3.0 add-in

3.5 add-in

1.1 add-in

.NET 1.1

Page 20: Overview of VS2010 and .NET 4.0

Side-By-Side (SxS) at .NET 4.0

.NET 2.0.NET 4.0

2.0 add-in

3.0

3.5

Host Process (i.e. Outlook)

3.0 add-in

3.5 add-in

4.0 add-in

Page 21: Overview of VS2010 and .NET 4.0

The target of CLR 4

In-Proc SxS

Native/Managed InteropDLR Integration

Managed Extensibility Framework

Threading Parallel Extensions

Garbage Collection Profiling

Code Contracts DebuggingCorrupted State Exceptions

Faster

With Fewer Bugs…

Working Better Together…

Page 22: Overview of VS2010 and .NET 4.0

The Parallel Computing Initiative

Based on the following premise:

“Concurrency for the masses”

Let the brightest developers solve business problems, not concurrency problems.

Page 23: Overview of VS2010 and .NET 4.0

Concurrency Landscape

For Visual Studio 2010 and the .NET Framework 4…

System.Threading Parallel Extensions

Unified Cancellation Model

Page 24: Overview of VS2010 and .NET 4.0

New System.Threading Primitives

A Barrier is a synchronization primitive that enforces the stopping of execution between a number of threads or processes at a given point and prevents further execution until all threads or processors have reached the given point.

A CountdownEvent is a synchronization primitive that enables ongoing tracking of a given workload in order to determine if processing of that workload is finished or not.

YUCK!

Page 25: Overview of VS2010 and .NET 4.0

Barrier“Let’s all head to Wasaga! We’ll meet at the gas station and leave from there.”

Mac

Charlie

Dennis

Wasaga

Barrier

Gas Station

Page 26: Overview of VS2010 and .NET 4.0

Unified Cancellation“Sir, we are ready to seat you…” - Hostess

CancellationTokenSource

CancellationToken

Page 27: Overview of VS2010 and .NET 4.0

THE UNIFIED CANCELLATION MODEL

Page 28: Overview of VS2010 and .NET 4.0

Parallel Extensinos

• A .NET Library that supports:– declarative and imperative data parallelism– imperative task parallelism

• Also provides a set of data structures that make coordination easier.

1. Parallel LINQ (PLINQ)

2. Task Parallel Library (TPL)

3. Coordination Data Structures (CDS)

Page 29: Overview of VS2010 and .NET 4.0

“Work Stealing” in Action

Worker Thread

1

Worker Thread

pProgram

ThreadTask 1

Task 2Task 3

Task 5Task 4

Page 30: Overview of VS2010 and .NET 4.0

Parallel Static Class

When program statements are independent…

…they can be parallelized

StatementA();StatementB();StatementC();

Parallel.Invoke( () => StatementA(), () => StatementB(), () => StatementC() );

Page 31: Overview of VS2010 and .NET 4.0

PARALLEL STATIC CLASS

Page 32: Overview of VS2010 and .NET 4.0

PLINQ

• Parallel LINQ (PLINQ) enables developers to easily leverage manycore with a minimal impact to existing LINQ programming model

var q = from p in people        where p.Name == queryInfo.Name && p.State == queryInfo.State && p.Year >= yearStart && p.Year <= yearEnd        orderby p.Year ascending        select p;

.AsParallel()

Page 33: Overview of VS2010 and .NET 4.0

PARALLELIZING LINQ

Page 34: Overview of VS2010 and .NET 4.0

The goal of CLR 4

In-Proc SxS

Native/Managed InteropDLR Integration

Managed Extensibility Framework

Threading Parallel Extensions

Garbage Collection Profiling

Code Contracts DebuggingCorrupted State Exceptions

Faster

With Fewer Bugs…

Working Better Together…

Page 35: Overview of VS2010 and .NET 4.0

Design By Contract

• Code Contracts introduce a way to specify contractual information that is not represented by a method or type’s signature alone.

Page 36: Overview of VS2010 and .NET 4.0

What is a Contract?

• A contract is…– An exchange of promises between two or more

parties to do, or refrain from doing, something• Key concept here is ‘promise’

Page 37: Overview of VS2010 and .NET 4.0

Why Contracts?

• Just because something compiles, doesn’t mean it works…

Page 38: Overview of VS2010 and .NET 4.0

A Contract contains…

• Pre-conditions - must be true before

• Post-conditions -must be true after

public Rational(int numerator, int denominator){Contract.Requires(denominator > 0); …}

public string GetPassword(){Contract.Ensures(Contract.Result<string>() != null); … return password;}

Page 39: Overview of VS2010 and .NET 4.0

A Contract contains…

• Invariants - must always be true

[ContractInvariantMethod]protected void ObjectInvariant(){Contract.Invariant(denominator > 0);}

Page 40: Overview of VS2010 and .NET 4.0

CODE CONTRACTS

Page 41: Overview of VS2010 and .NET 4.0

Database ChoicesRe

sour

ces

Dedicated

Shared

Low High“Friction”/Control

SQL Azure (RDBMS)

Value Props:Auto HA, Fault-ToleranceFriction-free scaleSelf-provisioningHigh compatibility

Virtual DB serverResource governance @ LDB Security @ LDB

Hosted Hosted SQL Server or other Resource governance @ VM Security @ DB Server/OS

On-premise SQL Server or other s/w on-premise Resource governance @ machine Security @ DB Server/OS

Value Props:Full h/w control – size/scale100% compatibilityRoll-your-own HA/DR/scale

Value Props:100% of API surface area

Roll-your-own HA/DR/scale

SQL Azure V1 targets scenarios that live in the lower left quadrant

Page 42: Overview of VS2010 and .NET 4.0

Windows Azure PlatformCompute: Virtualized compute environment based on Windows Server

Storage: Durable, scalable, & available storage

Management: Automated, model-driven management of the service

Database: Relational processing for structured/unstructured data

Service Bus: General purpose application bus

Access Control: Rules-driven, claims-based access

control

AppFabric

Page 43: Overview of VS2010 and .NET 4.0

Scenarios for V1• Departmental Applications

– Simple application built by individual or department– Need simple deployment, self-management, IT: “Empowerment and

Governance”

• Web Applications– Small business or startup that uses the cloud as their IT– Simple deployment, self-management, scale on demand

• ISV– ISV hosting software on behalf of customer– Multi-tenant support for billing and isolation

Page 44: Overview of VS2010 and .NET 4.0

V1 Application Topologies

MSDatacenter

SOAP/RESTHTTP/S

SQL Azure access from within MS Datacenter (Azure compute – ADO.NET)

Windows Azure

T-SQL (TDS)

MSDatacenter

T-SQL (TDS)

App Code / Tools

SQL Azure access from outside MS Datacenter (On-premises – ADO.NET)

App Code(ASP.NET)

ADO.NET Data Svcs/REST - EFHTTP/S

Code Far

SQL Data Services

SQL Data Services

Application/ Browser

Code Near

Page 45: Overview of VS2010 and .NET 4.0

SQL AzureDeployment

SQL AzureTDS Gateway

DB Script

Page 46: Overview of VS2010 and .NET 4.0

SQL AzureAccessing databases

Your App

Change Connection String

SQL AzureTDS Gateway

Page 47: Overview of VS2010 and .NET 4.0

CONNECTING TO SQL AZURE