43
.NET Foundation The future of .NET & C# Martin Woodward, Bertrand Le Roy

NET Foundation, Future of .NET and C#

Embed Size (px)

Citation preview

Page 1: NET Foundation, Future of .NET and C#

.NET FoundationThe future of .NET & C#

Martin Woodward, Bertrand Le Roy

Page 2: NET Foundation, Future of .NET and C#
Page 3: NET Foundation, Future of .NET and C#

[email protected]@martinwoodwardhttp://dotnetfoundation.orghttp://github.com/dotnet

Martin Woodward

Page 4: NET Foundation, Future of .NET and C#

I live here

Page 5: NET Foundation, Future of .NET and C#

I work here

Page 6: NET Foundation, Future of .NET and C#
Page 7: NET Foundation, Future of .NET and C#
Page 8: NET Foundation, Future of .NET and C#

OpennessCommunityRapid innovation

The .NET Foundation .NET API for Hadoop WebClient

.NET Compiler Platform ("Roslyn").NET Map Reduce API for Hadoop

.NET Micro Framework

ASP.NET MVCASP.NET Web API

ASP.NET Web Pages

ASP.NET SignalR

MVVM Light Toolkit

.NET Core 5

Orleans

MEF (Managed Extensibility Framework)

OWIN Authentication MiddlewareRx (Reactive Extensions)

Orchard CMS Windows Azure .NET SDK

Thinktecture IdentityManagerWnsRecipe

Mimekit Xamarin.AuthXamarin.Mobile

Couchbase for .NET

Meet the people behind the .NET Foundationhttp://www.dotnetfoundation.org/team

Join the conversation with the community http://www.dotnetfoundation.org @dotnetfdn

Mailkit

System.Drawing

ASP.NET 5

Salesforce Toolkits for .NET

NuGetKudu Cecil

MSBuild

LLILC

Prism

WorldWide Telescope

Page 9: NET Foundation, Future of .NET and C#

Practices VisibilityMentorshipSupportGovernanceFeedback

MediaEvents

Fostering a vibrant .NET ecosystem

ProtectionLicensesCopyrightsTrademarksPatents

dotnetfoundation.org dotnet.github.io@dotnetfdn

172 repositories19,105 forks3,767 contributors

Growing daily…

Openness.Community.Rapid innovation.

Page 10: NET Foundation, Future of .NET and C#

.NET Foundation Support Services• CLA Automation (inc self-service admin)• Domain Registration• DNS Management• SSL Certs• Authenticode Code Signing• Secret Management• Financial Authority• Forums• Email• MSDN• Swag

Page 11: NET Foundation, Future of .NET and C#
Page 12: NET Foundation, Future of .NET and C#
Page 13: NET Foundation, Future of .NET and C#
Page 14: NET Foundation, Future of .NET and C#

.NET Innovation

Cross-Platform

Open Source

The road ahead for .NET.NET Core

ASP.NET 5

Page 15: NET Foundation, Future of .NET and C#

.NET 2015

.NET Framework: Windows & full BCL

.NET Core: cross-platform & open-source

Page 16: NET Foundation, Future of .NET and C#

.NET Framework• Windows• ASP.NET 5• ASP.NET 4.6• WPF• Windows Forms

Page 17: NET Foundation, Future of .NET and C#

.NET Core• Cross-platform• 100% open-source• Application-local framework• Modular, using NuGet

Page 18: NET Foundation, Future of .NET and C#

.NET Native• Compiled to native code• Universal Windows Platform (UWP) apps• IoT devices, Mobile, PC, Xbox, Surface Hub

Page 19: NET Foundation, Future of .NET and C#

.NET Cross Platform• Linux: .NET Core + VS Code + OmniSharp• OSX: .NET Core + VS Code + OmniSharp• iOS & Android: Xamarin• Windows: .NET Framework, Core, VS, VS Code,

OmniSharp

Page 20: NET Foundation, Future of .NET and C#

.NET Open Source• .NET Core: CoreFx and CoreCLR• Full stack of C#, VB, and F#

Page 21: NET Foundation, Future of .NET and C#

C# Design Process• Design meetings up to 4 times a week• Design reviews once a month• Proposals and design notes on GitHub• Prototypes for early feedback

Page 22: NET Foundation, Future of .NET and C#

C# Evolution

C# 1Hello World

C# 2Generics

C# 3Linq

C# 4Dynamic

C# 5Async

C# 6Boilerplate

C# 7???

Page 23: NET Foundation, Future of .NET and C#

Roslyn: Great for consumers• Delightful IDE experiences• Code-aware libraries• A new generation of code analysis

Page 24: NET Foundation, Future of .NET and C#

Roslyn: Great for extenders• Rich APIs for understanding code• Analyzer and code fix framework

Page 25: NET Foundation, Future of .NET and C#

Roslyn: Great for us• Written in C#• Beautiful architecture• Less duplication between layers• A lot easier to write new features

Page 26: NET Foundation, Future of .NET and C#

C# 6 auto-property initializerspublic string FirstName { get; set; } = "Jane";

Page 27: NET Foundation, Future of .NET and C#

C# 6 getter-only auto-propertiespublic string FullName { get; } = "Jane Doe";

public Person(string first, string last){ FullName = first + " " + last;}

Page 28: NET Foundation, Future of .NET and C#

C# 6 expression-bodied memberspublic void Print() => Console.WriteLine(FullName);public string FullName => First + " " + Last;

Page 29: NET Foundation, Future of .NET and C#

C# 6 using staticusing static Console;using static System.DayOfWeek;

WriteLine(Wednesday – Monday);

Page 30: NET Foundation, Future of .NET and C#

C# 6 null-conditional operatorsif (json?["x"]?.Type == JTokenType.Integer && json?["y"]?.Type == JTokenType.Integer){ return new Point((int)json["x"], (int) json["y"]);}return null;

Page 31: NET Foundation, Future of .NET and C#

C# 6 string interpolationvar s = $"http://weblogs.asp.net/{blog}/{slug}";Console.WriteLine($"({point.X}, {point.Y})");

Page 32: NET Foundation, Future of .NET and C#

C# 6 nameofpublic Point Add(Point point){ if (point == null) { throw new ArgumentNullException(nameof(point)); }}

Page 33: NET Foundation, Future of .NET and C#

C# 6 index initializersreturn new JObject { ["x"] = X, ["y"] = Y };

Page 34: NET Foundation, Future of .NET and C#

C# 6 exception filters & await in catchtry { … }catch (SomeException e) when (e.IsCatastrophic){ await LogAsync(e);}finally{ await CloseAsync();}

Page 35: NET Foundation, Future of .NET and C#

C# 7 Competition• Java• “Systems”: Go, Rust, D, …• “Functional”: F#, Scala, Erlang, Clojure, …• “Compute”: Python, R, Matlab• JavaScript• Swift

Page 36: NET Foundation, Future of .NET and C#

Trends to watch for C# 7• Cloud & devices• Wire data• Performance• Asynchrony

Page 37: NET Foundation, Future of .NET and C#

Pattern matchingif (o is Point p && p.X == 5) { WriteLine(p.Y); }

if (o is Point{ X is 5, Y is var y }) { WriteLine(y); }

if (o is Point(5, var y)) { WriteLine(y); }

Patterns with variables

Variables in scope in body

Variables in scope in rest of condition

Recursive object pattern

Positional pattern

Page 38: NET Foundation, Future of .NET and C#

Patterns in switch statementsswitch (o){ case string s: Console.WriteLine(s); break; case int i: Console.WriteLine($"Number {i}"); break; case Point(int x, int y): Console.WriteLine($"({x},{y})"); break; case null: Console.WriteLine("<null>"); break;}

Switch on any type

Patterns in case clauses

variables in scope only in case?

Page 39: NET Foundation, Future of .NET and C#

Tuple typespublic (int sum, int count) Tally(IEnumerable<int> values) { … }

var t = Tally(myValues);Console.WriteLine($"Sum: {t.sum}, count: {t.count}");

public async Task<(int sum, int count)> TallyAsync(IEnumerable<int> values) { … }

var t = await TallyAsync(myValues);Console.WriteLine($"Sum: {t.sum}, count: {t.count}");

Like parameter lists

Page 40: NET Foundation, Future of .NET and C#

Tuple literalspublic (int sum, int count) Tally(IEnumerable<int> values){ var s = 0; var c = 0; foreach (var value in values) { s += value; c++; } return (s, c); }

public (int sum, int count) Tally(IEnumerable<int> values){ var res = (sum: 0, count: 0); foreach (var value in values) { res.sum += value; res.count++; } return res;}

Target typed

Types and names inferred

Page 41: NET Foundation, Future of .NET and C#

Nullable and non-nullable reference typesstring? n; // Nullable reference typestring s; // Non-nullable reference type

n = null; // Sure; it's nullables = null; // Warning! Shouldn’t be null!s = n; // Warning! Really!

WriteLine(s.Length); // Sure; it’s not nullWriteLine(n.Length); // Warning! Could be null!if (n != null) { WriteLine(n.Length); } // Sure; you checked

Page 42: NET Foundation, Future of .NET and C#

Local functionsIEnumerable<T> Filter<T>(IEnumerable<T> source, Func<T, bool> predicate){ if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate));

IEnumerable<T> Iterator() { foreach (var element in source) if (predicate(element)) yield return element; } return Iterator();}

Local (nested) functionCaptured type parameters

Captured variables

Page 43: NET Foundation, Future of .NET and C#

Other top feature ideasShorthand “record” typesPreferably with subclassesSupport immutable records and non-destructive mutation

Extension “everything”Great partner feature to pattern matching

Typed “views” of wire dataLike TypeScript types? Like F# type providers?

Ref returns and array slicesFor performance-critical code

Async collections and streamsAsync iterators and async foreach?