Overview of VS2010 and .NET 4.0

Preview:

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

An Overview of VS2010 and .NET 4.0

Visual Studio Targets Many…

Audience

Feat

ure

Set

Minimal

Complete

Hobbyist Enterprise

Professional

Team System

Express

…and there are Four Pillars

Understanding The Code

Building WebApplications

Creating OfficeBusiness

Applications

Using ThePower of

C++

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…

The Two Faces of Visual Studio 2010

Visual Studio As An Editor

An improved focus on… Writing code,

Understanding code,Navigating code,Publishing code

NEW VS2010 CAPABILITIES

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

Extension Manager

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

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

Applications Made Out of Parts

The Import/Export Business

Export

Import

Got

Need

Parts

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

…Put into Geek Terms

Part

Part Part

ImportMenus

Export aMenu

Import “Toolwindow”

Export IMenuService

Export “Toolwindow”

Import IMenuService

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

EXTENDING VISUAL STUDIO

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…

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

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

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…

The Parallel Computing Initiative

Based on the following premise:

“Concurrency for the masses”

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

Concurrency Landscape

For Visual Studio 2010 and the .NET Framework 4…

System.Threading Parallel Extensions

Unified Cancellation Model

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!

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

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

CancellationTokenSource

CancellationToken

THE UNIFIED CANCELLATION MODEL

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)

“Work Stealing” in Action

Worker Thread

1

Worker Thread

pProgram

ThreadTask 1

Task 2Task 3

Task 5Task 4

Parallel Static Class

When program statements are independent…

…they can be parallelized

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

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

PARALLEL STATIC CLASS

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()

PARALLELIZING LINQ

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…

Design By Contract

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

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’

Why Contracts?

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

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;}

A Contract contains…

• Invariants - must always be true

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

CODE CONTRACTS

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

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

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

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

SQL AzureDeployment

SQL AzureTDS Gateway

DB Script

SQL AzureAccessing databases

Your App

Change Connection String

SQL AzureTDS Gateway

CONNECTING TO SQL AZURE