• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
C5, vb11, f3
 

C5, vb11, f3

on

  • 1,697 views

Presentation about C# 5, F# 3 and VB11

Presentation about C# 5, F# 3 and VB11

Statistics

Views

Total Views
1,697
Views on SlideShare
629
Embed Views
1,068

Actions

Likes
0
Downloads
5
Comments
0

4 Embeds 1,068

http://rodrigovidal.net 659
http://www.rodrigovidal.net 402
http://www.linkedin.com 6
http://127.0.0.1 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    C5, vb11, f3 C5, vb11, f3 Presentation Transcript

    • Quem sou eu? Rodrigo Vidal  Twitter: @rodrigovidal  www.rodrigovidal.net Foco em Arquitetura de Software Evangelista da Linguagem F# Professional Scrum Developer Microsoft Student Partner
    • Evolução do C# e VB C# 4.0 + VB 10.0 Dinamismo + paridade nas linguagens C# 3.0 + VB 9.0 Language Integrated Query C# 2.0 + VB 8.0 GenericsC# 1.0 + VB 7.0 Código gerenciado
    • Tendências Declarativo Dinâmico
    • Tendências Aplicações cada vez mais conectadas  Mais latência  Mais problemas de responsividade da interface gráfica (IG)  Mais problemas de escalabilidade Programação assíncrona  Está se tornando a norma em aplicações escaladas e responsivas  APIs que são somente assíncronas, como JavaScript e Silverlight
    • Evolução do C# e VB C# 5.0 + VB 11.0 Programação assíncrona C# 4.0 + VB 10.0 Dinamismo + paridade nas linguagens C# 3.0 + VB 9.0 Language Integrated Query C# 2.0 + VB 8.0 GenericsC# 1.0 + VB 7.0 Código gerenciado
    • O que há de novo? Programação assíncrona  Programação assíncrona Atributos de informação de  Atributos de informação de chamada chamada  Iterators  Type Providers  Query Expressions
    • Assincronia em poucas palavras Síncrono  Espero o resultado antes de retonar  string DownloadString(...); Assíncrono  Retorne agora, chame de volta com o resultado  void DownloadStringAsync(..., Action<string> callback); Benefícios da assincronia  Responsividade da interface gráfica: libera as threads de IG para interação com o usuário  Escalabilidade do servidor: A thread pode ser reutilizada para outras requisições
    • Síncrono versus Assíncronovar data = DownloadData(...);ProcessData(data);DownloadDataAsync(... , data => { ProcessData(data);});
    • Síncrono versus Assíncronovar data = DownloadData(...);ProcessData(data);DownloadDataAsync(... , data => { ProcessData(data);});
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); } 
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); } 
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }  
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }  
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }   
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }    
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }     
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }      
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }       
    • Fluxo de controle assíncronoasync void DoWorkAsync() { var t1 = ProcessFeedAsync("www.acme.com/rss"); var t2 = ProcessFeedAsync("www.xyznews.com/rss"); await Task.WhenAll(t1, t2); DisplayMessage("Done");} async Task ProcessFeedAsync(string url) { var text = await DownloadFeedAsync(url); var doc = ParseFeedIntoDoc(text); await SaveDocAsync(doc); ProcessLog.WriteEntry(url); }       
    • Como funciona?async Task<XElement> GetRssAsync(string url) { var client = new WebClient(); var task = client.DownloadStringTaskAsync(url); var text = await task; var xml = XElement.Parse(text); return xml;}
    • Como funciona?async Task<XElement> GetRssAsync(string url) { var client = new WebClient(); var task = client.DownloadStringTaskAsync(url); var text = await task; var xml = XElement.Parse(text); return xml;} Task<XElement> GetRssAsync(string url) { var client = new WebClient(); var task = client.DownloadStringTaskAsync(url); return task.ContinueWith(delegate { var text = task.Result; var xml = XElement.Parse(text); return xml; }); }
    • Como funciona? Task<XElement> GetRssAsync(string url) { var $builder = AsyncTaskMethodBuilder<XElement>.Create();async Task<XElement> $state = 0; var TaskAwaiter<string> $a1;GetRssAsync(string url) { Action $resume = delegate { var client = new try { WebClient(); var task = if ($state == 1) goto L1;client.DownloadStringTaskAsync(url);new WebClient(); var client = var text = await task; task = client.DownloadStringTaskAsync(url); var $a1 = task.GetAwaiter(); var xml = XElement.Parse(text); return xml; if ($a1.IsCompleted) goto L1;} $state = 1; $a1.OnCompleted($resume); return; L1: var text = $a1.GetResult(); var xml = XElement.Parse(text); $builder.SetResult(xml); } catch (Exception $ex) { $builder.SetException($ex); } }; $resume(); return $builder.Task; }
    • Como funciona? Task<XElement> GetRssAsync(string url) { var $builder = AsyncTaskMethodBuilder<XElement>.Create();async Task<XElement> $state = 0; var TaskAwaiter<string> $a1;GetRssAsync(string url) { Action $resume = delegate { var client = new try { WebClient(); var task = if ($state == 1) goto L1;client.DownloadStringTaskAsync(url);new WebClient(); var client = var text = await task; task = client.DownloadStringTaskAsync(url); var $a1 = task.GetAwaiter(); var xml = XElement.Parse(text); return xml; if ($a1.IsCompleted) goto L1;} $state = 1; $a1.OnCompleted($resume); return; L1: var text = $a1.GetResult(); var xml = XElement.Parse(text); $builder.SetResult(xml); } catch (Exception $ex) { $builder.SetException($ex); } }; $resume(); return $builder.Task; }
    • Como funciona? Task<XElement> GetRssAsync(string url) { var $builder = AsyncTaskMethodBuilder<XElement>.Create();async Task<XElement> $state = 0; var TaskAwaiter<string> $a1;GetRssAsync(string url) { Action $resume = delegate { var client = new try { WebClient(); var task = if ($state == 1) goto L1;client.DownloadStringTaskAsync(url);new WebClient(); var client = var text = await task; task = client.DownloadStringTaskAsync(url); var $a1 = task.GetAwaiter(); var xml = XElement.Parse(text); return xml; if ($a1.IsCompleted) goto L1;} $state = 1; $a1.OnCompleted($resume); return; L1: var text = $a1.GetResult(); var xml = XElement.Parse(text); $builder.SetResult(xml); } catch (Exception $ex) { $builder.SetException($ex); } }; $resume(); return $builder.Task; }
    • Como funciona? Task<XElement> GetRssAsync(string url) { var $builder = AsyncTaskMethodBuilder<XElement>.Create();async Task<XElement> $state = 0; var TaskAwaiter<string> $a1;GetRssAsync(string url) { Action $resume = delegate { var client = new try { WebClient(); var task = if ($state == 1) goto L1;client.DownloadStringTaskAsync(url);new WebClient(); var client = var text = await task; task = client.DownloadStringTaskAsync(url); var $a1 = task.GetAwaiter(); var xml = XElement.Parse(text); return xml; if ($a1.IsCompleted) goto L1;} $state = 1; $a1.OnCompleted($resume); return; L1: var text = $a1.GetResult(); var xml = XElement.Parse(text); $builder.SetResult(xml); } catch (Exception $ex) { $builder.SetException($ex); } }; $resume(); return $builder.Task; }
    • Suporte no .NET Framework
    • Evolução do C# e VB C# 5.0 + VB 11.0 Programação assíncrona C# 4.0 + VB 10.0 Dinamismo + paridade nas linguagens C# 3.0 + VB 9.0 Language Integrated Query C# 2.0 + VB 8.0 GenericsC# 1.0 + VB 7.0 Código gerenciado
    • Compiler as a Service Clas Meta-programação s Read-Eval-Print Loop (REPL) public Foo Fiel Modelo de objetos d Incorporação de DSLs da linguagem private X string Código Assembly Source Fonte Source .NET Source code Compilador Source code code code
    • Roslyn APIs Language Service Compiler APIs Compiler Pipeline Metadata Import
    • Conteúdo Relacionado http://msdn.com/vstudio/async