SlideShare uma empresa Scribd logo
1 de 43
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
                           Generics

C# 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
                           Generics

C# 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íncrono
var data = DownloadData(...);
ProcessData(data);




DownloadDataAsync(... , data => {
    ProcessData(data);
});
Síncrono versus Assíncrono
var data = DownloadData(...);
ProcessData(data);




DownloadDataAsync(... , data => {
    ProcessData(data);
});
Fluxo de controle assíncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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íncrono
async 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
                           Generics

C# 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
C5, vb11, f3

Mais conteúdo relacionado

Semelhante a C5, vb11, f3

Windows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async ProgrammingWindows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async Programming
Oliver Scheer
 
The Evolution of Async-Programming on .NET Platform (TUP, Full)
The Evolution of Async-Programming on .NET Platform (TUP, Full)The Evolution of Async-Programming on .NET Platform (TUP, Full)
The Evolution of Async-Programming on .NET Platform (TUP, Full)
jeffz
 
CTU June 2011 - C# 5.0 - ASYNC & Await
CTU June 2011 - C# 5.0 - ASYNC & AwaitCTU June 2011 - C# 5.0 - ASYNC & Await
CTU June 2011 - C# 5.0 - ASYNC & Await
Spiffy
 
Introduction to the New Asynchronous API in the .NET Driver
Introduction to the New Asynchronous API in the .NET DriverIntroduction to the New Asynchronous API in the .NET Driver
Introduction to the New Asynchronous API in the .NET Driver
MongoDB
 

Semelhante a C5, vb11, f3 (20)

Welcome to an asynchronous world 1.29s
Welcome to an asynchronous world 1.29sWelcome to an asynchronous world 1.29s
Welcome to an asynchronous world 1.29s
 
Windows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async ProgrammingWindows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async Programming
 
Workshop: Async and Parallel in C#
Workshop: Async and Parallel in C#Workshop: Async and Parallel in C#
Workshop: Async and Parallel in C#
 
Asynchronous Programming in ASP.NET
Asynchronous Programming in ASP.NETAsynchronous Programming in ASP.NET
Asynchronous Programming in ASP.NET
 
동기화 시대를 뛰어넘는 비동기 프로그래밍
동기화 시대를 뛰어넘는 비동기 프로그래밍동기화 시대를 뛰어넘는 비동기 프로그래밍
동기화 시대를 뛰어넘는 비동기 프로그래밍
 
Binary Studio Academy: Concurrency in C# 5.0
Binary Studio Academy: Concurrency in C# 5.0Binary Studio Academy: Concurrency in C# 5.0
Binary Studio Academy: Concurrency in C# 5.0
 
Asynchronní programování
Asynchronní programováníAsynchronní programování
Asynchronní programování
 
The Evolution of Async-Programming on .NET Platform (TUP, Full)
The Evolution of Async-Programming on .NET Platform (TUP, Full)The Evolution of Async-Programming on .NET Platform (TUP, Full)
The Evolution of Async-Programming on .NET Platform (TUP, Full)
 
CTU June 2011 - C# 5.0 - ASYNC & Await
CTU June 2011 - C# 5.0 - ASYNC & AwaitCTU June 2011 - C# 5.0 - ASYNC & Await
CTU June 2011 - C# 5.0 - ASYNC & Await
 
Ondemand scaling-aws
Ondemand scaling-awsOndemand scaling-aws
Ondemand scaling-aws
 
Introduction to the New Asynchronous API in the .NET Driver
Introduction to the New Asynchronous API in the .NET DriverIntroduction to the New Asynchronous API in the .NET Driver
Introduction to the New Asynchronous API in the .NET Driver
 
Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)
 
Async Development con Visual Studio 2012
Async Development con Visual Studio 2012Async Development con Visual Studio 2012
Async Development con Visual Studio 2012
 
Web program-peformance-optimization
Web program-peformance-optimizationWeb program-peformance-optimization
Web program-peformance-optimization
 
Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30)
 
Introduction to Ajax programming
Introduction to Ajax programmingIntroduction to Ajax programming
Introduction to Ajax programming
 
El bueno, el feo y el malo
El bueno, el feo y el maloEl bueno, el feo y el malo
El bueno, el feo y el malo
 
About Node.js
About Node.jsAbout Node.js
About Node.js
 
Concurrency - responsiveness in .NET
Concurrency - responsiveness in .NETConcurrency - responsiveness in .NET
Concurrency - responsiveness in .NET
 
Async Programming in C# 5
Async Programming in C# 5Async Programming in C# 5
Async Programming in C# 5
 

Mais de Rodrigo Vidal (8)

Fij
FijFij
Fij
 
F#3.0
F#3.0 F#3.0
F#3.0
 
Monadic Design
Monadic DesignMonadic Design
Monadic Design
 
DevDay BH 2011 Programação Funcional
DevDay BH 2011 Programação FuncionalDevDay BH 2011 Programação Funcional
DevDay BH 2011 Programação Funcional
 
WebCamps Software Testing
WebCamps Software TestingWebCamps Software Testing
WebCamps Software Testing
 
Computacao em nuvem windows azure
Computacao em nuvem   windows azureComputacao em nuvem   windows azure
Computacao em nuvem windows azure
 
F# Functional and MultiCore Programming
F# Functional and MultiCore Programming F# Functional and MultiCore Programming
F# Functional and MultiCore Programming
 
F# Ignite - DNAD2010
F# Ignite - DNAD2010F# Ignite - DNAD2010
F# Ignite - DNAD2010
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

C5, vb11, f3

  • 1.
  • 2. 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
  • 3. 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 Generics C# 1.0 + VB 7.0 Código gerenciado
  • 4. Tendências Declarativo Dinâmico
  • 5. 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
  • 6. 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 Generics C# 1.0 + VB 7.0 Código gerenciado
  • 7. 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
  • 8. 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
  • 9. Síncrono versus Assíncrono var data = DownloadData(...); ProcessData(data); DownloadDataAsync(... , data => { ProcessData(data); });
  • 10. Síncrono versus Assíncrono var data = DownloadData(...); ProcessData(data); DownloadDataAsync(... , data => { ProcessData(data); });
  • 11. Fluxo de controle assíncrono async 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); }
  • 12. Fluxo de controle assíncrono async 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); }
  • 13. Fluxo de controle assíncrono async 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); }
  • 14. Fluxo de controle assíncrono async 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); }
  • 15. Fluxo de controle assíncrono async 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); }
  • 16. Fluxo de controle assíncrono async 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); }
  • 17. Fluxo de controle assíncrono async 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); }
  • 18. Fluxo de controle assíncrono async 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); } 
  • 19. Fluxo de controle assíncrono async 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); } 
  • 20. Fluxo de controle assíncrono async 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); }  
  • 21. Fluxo de controle assíncrono async 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); }  
  • 22. Fluxo de controle assíncrono async 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); }   
  • 23. Fluxo de controle assíncrono async 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); }    
  • 24. Fluxo de controle assíncrono async 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); }     
  • 25. Fluxo de controle assíncrono async 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); }      
  • 26. Fluxo de controle assíncrono async 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); }       
  • 27. Fluxo de controle assíncrono async 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); }       
  • 28. 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; }
  • 29. 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; }); }
  • 30.
  • 31. 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; }
  • 32. 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; }
  • 33. 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; }
  • 34. 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; }
  • 35. Suporte no .NET Framework
  • 36.
  • 37. 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 Generics C# 1.0 + VB 7.0 Código gerenciado
  • 38. 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
  • 39. Roslyn APIs Language Service Compiler APIs Compiler Pipeline Metadata Import
  • 40.
  • 41.