Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lucian Wischik VB+C# language PM Microsoft Corporation The Future of VB and C#

Similar presentations


Presentation on theme: "Lucian Wischik VB+C# language PM Microsoft Corporation The Future of VB and C#"— Presentation transcript:

1 Lucian Wischik VB+C# language PM Microsoft Corporation The Future of VB and C#

2 Outline The near future Async The distant future Compiler as a Service

3 The near future of VB and C# Managed Code Generics LINQ Co-evolution C#1, VB7 C#2, VB8 C#3, VB9 C#4, VB10 Async programming C# vNext, VB vNext

4 Async programming, ???, ???, ???, ??? The near future of VB and C# Managed Code Generics, EnC, My, Disposing, partial, nullables, XML-comments LINQ, lambdas, XML literals, type inference, extensions Co-evolution, NOPIA, DLR, covariance, stmt-lambdas C#1, VB7 C#2, VB8 C#4, VB10 C# vNext, VB vNext C#3, VB9

5 What is async? In the past… “Connected” has generally meant either a UI that freezes, or unmaintainable spaghetti code, or multithreading. C# and VB future: Async… A new easier way to write connected apps Two new keywords: Await and Async in VB and C# A new Task-based design pattern for APIs, the "T.A.P." (Task Asynchronous Pattern) A new set of.NET Framework APIs

6

7 webClient.UploadString(uri); print("done"); webClient.UploadString(uri); print("done");

8

9 “A waiter’s job is to wait on a table until the patrons have finished their meal. If you want to serve two tables concurrently, you must hire two waiters.”

10 The following is from the Android dev blog. Can you spot the flaw? 1. “A good practice in creating responsive applications is to make sure your main UI thread does the minimum amount of work.” 2. “Any potentially long task that may hang your application should be handled in a different thread.” 3. “Typical examples of such tasks are network operations, which involve unpredictable delays.”

11 How best to explain the sequence of events in a restaurant with several tables? From the perspective of the waiter? or of the patrons?

12

13

14 TASK UNIFIES ALL THESE AREAS; ASYNC TIES THEM TOGETHER Use Async Functions to compose other tasks, for the “orchestration” of your app try { string[] vidUrls = await ScrapeYoutubeAsync(url); // Network-bound Task t1 = DownloadVideoAsync(vidUrls(0)); // Start 2 downloads Task t2 = DownloadVideoAsync(vidUrls(1)); Video[] vids = await TaskEx.WhenAll(t1, t2); // Wait for both Video v = await MashupVideosAsync(vids(0), vids(1)); // CPU-bound await v.SaveAsync(textbox1.Text); // IO-bound } catch (WebException ex) { ReportError(ex); } try { string[] vidUrls = await ScrapeYoutubeAsync(url); // Network-bound Task t1 = DownloadVideoAsync(vidUrls(0)); // Start 2 downloads Task t2 = DownloadVideoAsync(vidUrls(1)); Video[] vids = await TaskEx.WhenAll(t1, t2); // Wait for both Video v = await MashupVideosAsync(vids(0), vids(1)); // CPU-bound await v.SaveAsync(textbox1.Text); // IO-bound } catch (WebException ex) { ReportError(ex); }

15 Co-evolution VB catches up: Iterators XNA Phone Async: was developed in both languages simultaneously

16 The far future Managed Code Generics LINQ Parity C#1, VB7 C#2, VB8 C#3, VB9 C#4, VB10 Async C# vNext, VB vNext Compiler as a Service

17 Dim connectionString = "server=.\sqlexpress;..." Using con = New SqlConnection(connectionString) con.Open() Dim cmd = New SqlCommand("GetSalesFormulas", con) Using reader = Await cmd.ExecuteReaderAsync() reader.Read() Dim formula As String = reader("vb").ToString() Dim result = Runtime.CompilerServices.Eval(formula) End Using Dim connectionString = "server=.\sqlexpress;..." Using con = New SqlConnection(connectionString) con.Open() Dim cmd = New SqlCommand("GetSalesFormulas", con) Using reader = Await cmd.ExecuteReaderAsync() reader.Read() Dim formula As String = reader("vb").ToString() Dim result = Runtime.CompilerServices.Eval(formula) End Using Compiler as a Service

18 Class Field public Foo private string X X Compiler Source code Source File Source code.NET Assembly Meta-programmingRead-Eval-Print Loop Language Object Model DSL Embedding

19

20 Other possible futures

21 Sorry, we haven’t figured this one out yet... simpler INotifyPropertyChanged support and also Dependency Properties

22 Oh, and check out F# F# had async before C#/VB Check out "F# type providers" Check out F# immutable programming

23

24 © 2011 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. PS. Download the Async CTP PS. Download the Async CTP


Download ppt "Lucian Wischik VB+C# language PM Microsoft Corporation The Future of VB and C#"

Similar presentations


Ads by Google