lap around .net 4

46
A Tour of .NET 4 Scott Hanselman Principal Program Manager Lead [email protected] @shanselman on Twitter

Upload: abdul-khan

Post on 31-Oct-2014

692 views

Category:

Education


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Lap around .net 4

A Tour of .NET 4Scott Hanselman

Principal Program Manager [email protected] @shanselman on Twitter

Page 2: Lap around .net 4

Cost Cuttingin VS 2010

Page 3: Lap around .net 4

Layoffs.

Page 4: Lap around .net 4

Layoffs.

Page 5: Lap around .net 4

Layoffs.

Page 6: Lap around .net 4

Layoffs.

Page 7: Lap around .net 4

Layoffs.

Page 8: Lap around .net 4

A Look Back…

.NET 1.0 .NET 1.1 .NET 2.0

3.0

3.5

.NET 4

2002 2003 2010 RTM2005-08

CLR 1.0 CLR 1.1 CLR 2.0 CLR 4

SP1

<configuration> <system.web> <compilation debug="true” targetFramework="4.0" /> </system.web></configuration>

Page 9: Lap around .net 4

Web Forms 4 - Client ID

Page 10: Lap around .net 4

Web Forms 4 - Client ID

Page 11: Lap around .net 4

Clean HTML

Ability to specify client IDs on controlsImproves client script and CSS supportClientIdMode = Static, Predictable, Auto, Inherit

CSS rendering supportRemove the need to use CSS adaptersDefer to CSS and bypass existing style propertiesSupport non-table-based HTML rendering

ViewState improvementsDisable at app/page level, enable per control

Page 12: Lap around .net 4

Core ASP.NET Improvements

Cache ExtensibilityEnable disk based cachingIntegrate with new “Velocity” distributed cache

Automatically Pre-Start ApplicationsEnable applications to precache/load data

Perf Monitoring on a per-application basisSyntax for automatically HTML encoding

<%: Message %>

Page 13: Lap around .net 4

Deployment

End to end packaging and deploying of web applications Enables customized configurations

Supports databases, SSL certs, custom registry entries, file ACLs, etcWorks great with hosted environments

Page 14: Lap around .net 4

ASP.NET Web Forms 4Client Id / Routing

demo

Page 15: Lap around .net 4
Page 16: Lap around .net 4

Microsoft AJAX CDN

Free CDN hosting of AJAX library scriptsASP.NET AJAX 4jQuery and jQuery Validation

<script src=“http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js” type="text/javascript“ />

Built-in support with <asp:scriptmanager>

Page 17: Lap around .net 4

AJAX 4 - Client Templates

Server-Side (WebForms):<ItemTemplate>

<li><%# Eval("Name") %></li></ItemTemplate>

Client-Side<ul class="sys-template">

<li>{{ Name }}</li></ul>

Page 18: Lap around .net 4

AJAX 4 - DataContext

ASMX

WCF

ADO.NETData Services

ASP.NET MVCJsonResult

Etc.

1. Request

2. JSON DataData

Context

3. Modify Data 4. Save Data

* DataContext includes change tracking automatically

Page 19: Lap around .net 4

ASP.NET AJAX 4Client Templates/ Odata

demo

Page 20: Lap around .net 4

WPF 4

Data Grid Ribbon Multi-Touch Windows 7 Enhancements

Page 21: Lap around .net 4
Page 22: Lap around .net 4
Page 23: Lap around .net 4

Managed Extensibility Framework?

The Managed Extensibility Framework (MEF) is a new library in the .NET Framework that enables greater reuse of applications and components. Using MEF, .NET applications can make the shift from being statically compiled to dynamically composed

Page 24: Lap around .net 4
Page 25: Lap around .net 4

Open/Closed Principle

Software entities should be open for extension,

but closed for modification.

Page 26: Lap around .net 4

Client ApplicationsWPF 4 DataGrid / MEF

demo

Page 27: Lap around .net 4

The Parallel Computing Initiative

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

“Concurrency for the masses”

Page 28: Lap around .net 4
Page 29: Lap around .net 4

Parallel Computing with .NET 4

1. Task Parallel Library (TPL)2. Parallel LINQ (PLINQ)3. Coordination Data Structures

(CDS)4. System.Threading

Improvements

Page 30: Lap around .net 4

Parallel LINQ

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 31: Lap around .net 4

Parallel ComputingParallel LINQ and PFX

demo

Page 32: Lap around .net 4

Common Language Runtime

Statically-Typed

C#VB

RubyPython

Dynamically-Typed

Why the DLR?

Page 33: Lap around .net 4

Common Language Runtime

Statically-Typed

C#VB

RubyPython

Dynamically-Typed

Dynamic Language Runtime

Why the DLR?

Page 34: Lap around .net 4

PythonBinder

RubyBinder

COMBinder

RuntimeBinder

RuntimeBinder

.NET Dynamic Programming

Dynamic Language Runtime

Expression Trees Dynamic Dispatch Call Site Caching

IronPython IronRuby C# VB.NET Others…

Page 35: Lap around .net 4

DLR IntegrationDynamic for all!

demo

Page 36: Lap around .net 4

Dynamically Typed Objects

Calculator calc = GetCalculator();int sum = calc.Add(10, 20);

object calc = GetCalculator();Type calcType = calc.GetType();object res = calcType.InvokeMember("Add", BindingFlags.InvokeMethod, null, new object[] { 10, 20 });int sum = Convert.ToInt32(res);

ScriptObject calc = GetCalculator();object res = calc.Invoke("Add", 10, 20);int sum = Convert.ToInt32(res);

dynamic calc = GetCalculator();int sum = calc.Add(10, 20);

Statically typed to be

dynamic

Dynamic method invocation

Dynamic conversion

Page 37: Lap around .net 4

Type Equivalence

Interop Assemblies translate between managed code and COM

For each interface, struct, enum, delegate, and member, contains a

managed equivalent with marshalling data

Page 38: Lap around .net 4

Primary Interop Assemblies cause many pain points…

However!

Page 39: Lap around .net 4

Go Away, PIA!

1. Compilers embed the portions of the interop assemblies that the add-ins actually use

2. Runtime ensures the embedded definitions of these types are considered equivalent

Page 40: Lap around .net 4

CLR 4Type Equivalence

demo

Page 41: Lap around .net 4

.NET Framework Compatibility

.NET 4.0 is a highly compatible release.NET 4.0 does not auto–roll forward

You must add a configuration file with a specific switch to get 3.5 apps to run on 4.0

Page 42: Lap around .net 4

CLR 2 - Existing Side-By-Side

Host Process (i.e. Outlook)

.NET 2.0

2.0 add-in

3.03.5

3.0 add-in

3.5 add-in

1.1 add-in

.NET 1.1

Page 43: Lap around .net 4

CLR 4 - In-Process Side-By-Side

.NET 2.0.NET 4.0

2.0 add-in

3.03.5

Host Process (i.e. Outlook)

3.0 add-in

3.5 add-in

4.0 add-in

Page 44: Lap around .net 4

CLR 4In-Process Side-By-Side

demo

Page 45: Lap around .net 4

Be well,write good code,and stay in touch

[email protected]://hanselman.com

@shanselman on Twitter

Page 46: Lap around .net 4

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