SlideShare una empresa de Scribd logo
1 de 29
LINQ, Take TwoRealizing the LINQ to Everything Dream Bart J.F. De Smet Software Development Engineer Microsoft Corporation
What’s LINQ?A historical perspective 5 years ago Little recent innovation Where’s the cloud? Censored
Essential LINQLanguage Integrated Monads Why? What? How?
Could there be more? Essential LINQThe monadic Bind operator IEnumerable<T> IQueryable<T> new[]{ 42 } IEnumerable<T> SelectMany<T, R>(this IEnumerable<T> source,Func<T, IEnumerable<R>> selector) SelectMany Also see www.codeplex.com/LINQSQO for “Project MinLINQ”
Essential LINQMaybe monad (for fun and no profit) Null-propagating dot string s = name?.ToUpper(); One single library function suffices Syntactic          sugar name.SelectMany(    _ => _.ToUpper(),     s => s) from _ in name from s in _.ToUpper() select s Compiler
Essential LINQ Bart J.F. De Smet Software Development Engineer Cloud Programmability Team demo
Query Providers RevisitedWhy do we have IQueryable<T>? Does it really have to be a runtime check? Implements IQueryable<T> varsrc = newQueryProvider<Product>(); varres = from p insrc wherep.Price > 100m groupp byp.Category; foreach(var p in res) Console.WriteLine(p); Compiles fine
Query Providers RevisitedLeveraging the query pattern varres = from p insrc           wherep.Price > 100m groupp byp.Category; Syntactic sugar varres = src .Where(p => p.Price> 100m) .GroupBy(p => p.Category); No GroupBy“edge” Can be instance methods Select Where Source<T> Filtered<T> Projected<T>
Query Providers RevisitedTaking it one step further Recipe Method overloads Type state machine Operator overloads varres = fromtweet intwitter           where tweet.     == “Bart” From About From Location From      == “LINQ”           where tweet. About About About Location           select tweet; Query “learns” From operator overloading “Has a” type classTwitter { publicTwitterByFromWhere(Func<TweetAboutFromLoc, FilterFrom> filter); // Other filter methods } classTwitterByFrom { publicTwitterByAboutFromWhere(Func<TweetAboutLoc, FilterAbout> filter); // Other filter methods     // Fields with current filters } Custom syntax trees
Query Providers Revisited Bart J.F. De Smet Software Development Engineer Cloud Programmability Team demo
Asynchronous Data Access (𝑓 ◦ 𝑔)(𝑥) = 𝑓(𝑔(𝑥))   Way simpler with Rx Rx is a library for composing asynchronous and event-basedprograms using observable collections. Queries! LINQ! Download at MSDN DevLabs ,[object Object]
JavaScript (RxJS)
XNA 3.1 for XBOX and Zune
Windows Phone 7,[object Object]
Asynchronous Data AccessEssential interfaces interfaceIObservable<outT> { IDisposableSubscribe(IObserver<T> observer);} interfaceIObserver<in T> { voidOnNext(T value); voidOnError(Exception ex); voidOnCompleted(); } Both interfaces ship in the .NET 4 BCL
IQbservable<T> LINQ to WMI Events How? ToQbservable Translatable (Expression trees) IQueryable<T> LINQ to SQL ToQueryable LINQ to *.* AsObservable Homo-iconic AsEnumerable AsQbservable AsQueryable ToObservable IEnumerable<T> LINQ to Objects IObservable<T> LINQ to Events Fixed (MSIL) ToEnumerable Pull(interactive) Push (reactive) What? Duality Concurrency(IScheduler) Where? Message loops Distributed Worker pools Threads
IObservable<T> Asynchronous Data AccessIQbservable<T> interfaceIQbservable<outT> : IObservable<T> { ExpressionExpression  { get; } TypeElementType { get; } IQbservableProvider Provider    { get; } } interfaceIQbservableProvider { IQbservable<R> CreateQuery<R>(Expression expression); } We welcome semantic discussions. Extended role for some operators No Execute method
LINQ to WMI Events (WQL) Bart J.F. De Smet Software Development Engineer Cloud Programmability Team demo
Asynchronous Data AccessC# 5.0 and VB 11.0 “await” One versus many? IObservable<T> interface – many results Task<T> concrete class – one result Task<T> based language feature Rx bridge by implementing the “await pattern” IAsyncEnumerable<T>
Asynchronous Bridge for C# and VB “await” Bart J.F. De Smet Software Development Engineer Cloud Programmability Team announcing
Where execution happensIScheduler interface System.Concurrencyin System.CoreEx Introduction of concurrency interfaceIScheduler { DateTimeOffsetNow { get; } IDisposable Schedule(Action action); IDisposable Schedule(Actionaction, TimeSpandueTime);} ToObservable IObservable<T> IEnumerable<T> ToEnumerable Synchronous Asynchronous
Where execution happensIScheduler specifies “where” Imported TextBoxTextChangedevent var res = from word ininput.DistinctUntilChanged()                             .Throttle(TimeSpan.FromSeconds(0.5)) from words in lookup(word) select words; Asynchronous web service call Indicates where things run Use of scheduler to synchronize res.Subscribe(words => { lst.Items.Clear(); lst.Items.AddRange((fromwordinwords selectword.Word).ToArray());}); res.ObserveOn(newControlScheduler(frm)).Subscribe(words => { lst.Items.Clear(); lst.Items.AddRange((fromwordinwords selectword.Word).ToArray());});
Where execution happensIScheduler parameterization Baked in notion of “where”? Entry-point for the schema Custom schedulers could be very rich (e.g. server farm) varctx = new NorthwindDataContext();  var res = from product inctx.Products whereproduct.Price > 100m selectproduct.Name; Decoupled “what” from “where” foreach(varproduct inres.RemoteOn(newSqlScheduler(“server”)))     // Process product
Where execution happensExpression tree remoting Rx .NET fromtickerinstocks whereticker.Symbol == “MSFT” selectticker.Quote Observable data source JSON              serializer Retargeting to AJAX RxJS stocks .Where(function (t) { returnt.Symbol == “MSFT”; }) .Select(function (t) { returnt.Quote; })
Remoting of Query Operators Bart J.F. De Smet Software Development Engineer Cloud Programmability Team demo
LINQ to the unexpectedConstraint solving Non-persistent Model[ Decisions[Reals, SA, VZ],   Goals[ Minimize[20 * SA + 15 * VZ]   ], Constraints[      C1 -> 0.3 * SA + 0.4 * VZ >= 2000,     C2 -> 0.4 * SA + 0.2 * VZ >= 1500,     C3 -> 0.2 * SA + 0.3 * VZ >= 500,     C4 -> SA <= 9000,     C5 -> VZ <= 6000,     C6 -> SA >= 0,     C7 -> VZ >= 0   ] ] fromminctx.CreateModel(new { vz = default(double),    sa = default(double) }) where 0.3 * m.sa + 0.4 * m.vz >= 2000    && 0.4 * m.sa + 0.2 * m.vz >= 1500    && 0.2 * m.sa + 0.3 * m.vz >= 500 where 0 <= m.sa && m.sa <= 9000    && 0 <= m.vz && m.vz <= 6000 orderby 20 * m.sa + 15 * m.vz selectm Cost / barrel Refinement % Max # barrels Min # barrels To compute call Solve
LINQ to the unexpectedJoining with reactive sources Observabledata sources fromcostSAinGetPriceMonitor("SA") fromcostVZinGetPriceMonitor("VZ") fromminctx.CreateModel(new { vz = default(double), sa = default(double) }) where0.3 * m.sa + 0.4 * m.vz >= 2000    && 0.4 * m.sa + 0.2 * m.vz >= 1500    && 0.2 * m.sa + 0.3 * m.vz >= 500 where0 <= m.sa && m.sa <= 9000    && 0 <= m.vz && m.vz <= 6000 orderbycostSA* m.sa + costVZ* m.vz selectm SelectMany Subscribe here! Parametersto decision
Theorem Solving using Z3 Bart J.F. De Smet Software Development Engineer Cloud Programmability Team demo

Más contenido relacionado

La actualidad más candente

Deep Dumpster Diving
Deep Dumpster DivingDeep Dumpster Diving
Deep Dumpster DivingRonnBlack
 
The Ring programming language version 1.5.2 book - Part 13 of 181
The Ring programming language version 1.5.2 book - Part 13 of 181The Ring programming language version 1.5.2 book - Part 13 of 181
The Ring programming language version 1.5.2 book - Part 13 of 181Mahmoud Samir Fayed
 
JPoint 2016 - Валеев Тагир - Странности Stream API
JPoint 2016 - Валеев Тагир - Странности Stream APIJPoint 2016 - Валеев Тагир - Странности Stream API
JPoint 2016 - Валеев Тагир - Странности Stream APItvaleev
 
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDBBuilding a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDBCody Ray
 
Aaron Bedra - Effective Software Security Teams
Aaron Bedra - Effective Software Security TeamsAaron Bedra - Effective Software Security Teams
Aaron Bedra - Effective Software Security Teamscentralohioissa
 
あなたのScalaを爆速にする7つの方法
あなたのScalaを爆速にする7つの方法あなたのScalaを爆速にする7つの方法
あなたのScalaを爆速にする7つの方法x1 ichi
 
PyCon KR 2019 sprint - RustPython by example
PyCon KR 2019 sprint  - RustPython by examplePyCon KR 2019 sprint  - RustPython by example
PyCon KR 2019 sprint - RustPython by exampleYunWon Jeong
 
Managing Data and Operation Distribution In MongoDB
Managing Data and Operation Distribution In MongoDBManaging Data and Operation Distribution In MongoDB
Managing Data and Operation Distribution In MongoDBJason Terpko
 
Using Reflections and Automatic Code Generation
Using Reflections and Automatic Code GenerationUsing Reflections and Automatic Code Generation
Using Reflections and Automatic Code GenerationIvan Dolgushin
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksMongoDB
 
Garbage collector in python
Garbage collector in pythonGarbage collector in python
Garbage collector in pythonIbrahim Kasim
 
JavaScript Arrays
JavaScript Arrays JavaScript Arrays
JavaScript Arrays Reem Alattas
 
Down to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap DumpsDown to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap DumpsAndrei Pangin
 
Functional Reactive Programming with RxJS
Functional Reactive Programming with RxJSFunctional Reactive Programming with RxJS
Functional Reactive Programming with RxJSstefanmayer13
 
Java practice programs for beginners
Java practice programs for beginnersJava practice programs for beginners
Java practice programs for beginnersishan0019
 
Annotation processing and code gen
Annotation processing and code genAnnotation processing and code gen
Annotation processing and code genkoji lin
 
連邦の白いヤツ 「Objective-C」
連邦の白いヤツ 「Objective-C」連邦の白いヤツ 「Objective-C」
連邦の白いヤツ 「Objective-C」matuura_core
 
A Fast and Efficient Time Series Storage Based on Apache Solr
A Fast and Efficient Time Series Storage Based on Apache SolrA Fast and Efficient Time Series Storage Based on Apache Solr
A Fast and Efficient Time Series Storage Based on Apache SolrQAware GmbH
 

La actualidad más candente (20)

Deep Dumpster Diving
Deep Dumpster DivingDeep Dumpster Diving
Deep Dumpster Diving
 
The Ring programming language version 1.5.2 book - Part 13 of 181
The Ring programming language version 1.5.2 book - Part 13 of 181The Ring programming language version 1.5.2 book - Part 13 of 181
The Ring programming language version 1.5.2 book - Part 13 of 181
 
Python Objects
Python ObjectsPython Objects
Python Objects
 
JPoint 2016 - Валеев Тагир - Странности Stream API
JPoint 2016 - Валеев Тагир - Странности Stream APIJPoint 2016 - Валеев Тагир - Странности Stream API
JPoint 2016 - Валеев Тагир - Странности Stream API
 
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDBBuilding a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
 
Aaron Bedra - Effective Software Security Teams
Aaron Bedra - Effective Software Security TeamsAaron Bedra - Effective Software Security Teams
Aaron Bedra - Effective Software Security Teams
 
あなたのScalaを爆速にする7つの方法
あなたのScalaを爆速にする7つの方法あなたのScalaを爆速にする7つの方法
あなたのScalaを爆速にする7つの方法
 
PyCon KR 2019 sprint - RustPython by example
PyCon KR 2019 sprint  - RustPython by examplePyCon KR 2019 sprint  - RustPython by example
PyCon KR 2019 sprint - RustPython by example
 
Angular2 rxjs
Angular2 rxjsAngular2 rxjs
Angular2 rxjs
 
Managing Data and Operation Distribution In MongoDB
Managing Data and Operation Distribution In MongoDBManaging Data and Operation Distribution In MongoDB
Managing Data and Operation Distribution In MongoDB
 
Using Reflections and Automatic Code Generation
Using Reflections and Automatic Code GenerationUsing Reflections and Automatic Code Generation
Using Reflections and Automatic Code Generation
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
Garbage collector in python
Garbage collector in pythonGarbage collector in python
Garbage collector in python
 
JavaScript Arrays
JavaScript Arrays JavaScript Arrays
JavaScript Arrays
 
Down to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap DumpsDown to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap Dumps
 
Functional Reactive Programming with RxJS
Functional Reactive Programming with RxJSFunctional Reactive Programming with RxJS
Functional Reactive Programming with RxJS
 
Java practice programs for beginners
Java practice programs for beginnersJava practice programs for beginners
Java practice programs for beginners
 
Annotation processing and code gen
Annotation processing and code genAnnotation processing and code gen
Annotation processing and code gen
 
連邦の白いヤツ 「Objective-C」
連邦の白いヤツ 「Objective-C」連邦の白いヤツ 「Objective-C」
連邦の白いヤツ 「Objective-C」
 
A Fast and Efficient Time Series Storage Based on Apache Solr
A Fast and Efficient Time Series Storage Based on Apache SolrA Fast and Efficient Time Series Storage Based on Apache Solr
A Fast and Efficient Time Series Storage Based on Apache Solr
 

Destacado

Announcements, 7/26/15
Announcements, 7/26/15Announcements, 7/26/15
Announcements, 7/26/15CLADSM
 
Wednesday Night Series - "How People Change", Week 2
Wednesday Night Series - "How People Change", Week 2Wednesday Night Series - "How People Change", Week 2
Wednesday Night Series - "How People Change", Week 2CLADSM
 
British Versus American English...
British Versus American English...British Versus American English...
British Versus American English...lorinchina
 
Announcements, 3/18/12
Announcements, 3/18/12Announcements, 3/18/12
Announcements, 3/18/12CLADSM
 
Announcements, 3/20/11
Announcements, 3/20/11Announcements, 3/20/11
Announcements, 3/20/11CLADSM
 
There's Something About That Name Slides, 3/13/11
There's Something About That Name Slides, 3/13/11There's Something About That Name Slides, 3/13/11
There's Something About That Name Slides, 3/13/11CLADSM
 
20 questions.guess what it is.describe what it is.
20 questions.guess what it is.describe what it is.20 questions.guess what it is.describe what it is.
20 questions.guess what it is.describe what it is.lorinchina
 
A Keynote Address by Lord David Puttnam
A Keynote Address by Lord David PuttnamA Keynote Address by Lord David Puttnam
A Keynote Address by Lord David PuttnamEduSkills OECD
 
Changed Lives Draw Crowds Slides, 4/24/11
Changed Lives Draw Crowds Slides, 4/24/11Changed Lives Draw Crowds Slides, 4/24/11
Changed Lives Draw Crowds Slides, 4/24/11CLADSM
 
Shaping the future of education
Shaping the future of educationShaping the future of education
Shaping the future of educationEduSkills OECD
 
Announcements, 3/4/12
Announcements, 3/4/12Announcements, 3/4/12
Announcements, 3/4/12CLADSM
 
Announcements, 3/25/12
Announcements, 3/25/12Announcements, 3/25/12
Announcements, 3/25/12CLADSM
 
Announcements, 5/18/14
Announcements, 5/18/14Announcements, 5/18/14
Announcements, 5/18/14CLADSM
 
About Those Gifts Slides, 3/8/15
About Those Gifts Slides, 3/8/15About Those Gifts Slides, 3/8/15
About Those Gifts Slides, 3/8/15CLADSM
 
Portfolio 2011
Portfolio 2011Portfolio 2011
Portfolio 2011holtk
 
Announcements, 8/12/12
Announcements, 8/12/12Announcements, 8/12/12
Announcements, 8/12/12CLADSM
 
Spatial Thinking and Stem Education: Drawing and Mapping with New Technologies
Spatial Thinking and Stem Education: Drawing and Mapping with New TechnologiesSpatial Thinking and Stem Education: Drawing and Mapping with New Technologies
Spatial Thinking and Stem Education: Drawing and Mapping with New TechnologiesEduSkills OECD
 
Announcements, 8/17/14
Announcements, 8/17/14Announcements, 8/17/14
Announcements, 8/17/14CLADSM
 
Announcements, 8/30/15
Announcements, 8/30/15Announcements, 8/30/15
Announcements, 8/30/15CLADSM
 

Destacado (20)

Announcements, 7/26/15
Announcements, 7/26/15Announcements, 7/26/15
Announcements, 7/26/15
 
Wednesday Night Series - "How People Change", Week 2
Wednesday Night Series - "How People Change", Week 2Wednesday Night Series - "How People Change", Week 2
Wednesday Night Series - "How People Change", Week 2
 
British Versus American English...
British Versus American English...British Versus American English...
British Versus American English...
 
Announcements, 3/18/12
Announcements, 3/18/12Announcements, 3/18/12
Announcements, 3/18/12
 
Announcements, 3/20/11
Announcements, 3/20/11Announcements, 3/20/11
Announcements, 3/20/11
 
There's Something About That Name Slides, 3/13/11
There's Something About That Name Slides, 3/13/11There's Something About That Name Slides, 3/13/11
There's Something About That Name Slides, 3/13/11
 
20 questions.guess what it is.describe what it is.
20 questions.guess what it is.describe what it is.20 questions.guess what it is.describe what it is.
20 questions.guess what it is.describe what it is.
 
Ung dung web chuong 9
Ung dung web  chuong 9Ung dung web  chuong 9
Ung dung web chuong 9
 
A Keynote Address by Lord David Puttnam
A Keynote Address by Lord David PuttnamA Keynote Address by Lord David Puttnam
A Keynote Address by Lord David Puttnam
 
Changed Lives Draw Crowds Slides, 4/24/11
Changed Lives Draw Crowds Slides, 4/24/11Changed Lives Draw Crowds Slides, 4/24/11
Changed Lives Draw Crowds Slides, 4/24/11
 
Shaping the future of education
Shaping the future of educationShaping the future of education
Shaping the future of education
 
Announcements, 3/4/12
Announcements, 3/4/12Announcements, 3/4/12
Announcements, 3/4/12
 
Announcements, 3/25/12
Announcements, 3/25/12Announcements, 3/25/12
Announcements, 3/25/12
 
Announcements, 5/18/14
Announcements, 5/18/14Announcements, 5/18/14
Announcements, 5/18/14
 
About Those Gifts Slides, 3/8/15
About Those Gifts Slides, 3/8/15About Those Gifts Slides, 3/8/15
About Those Gifts Slides, 3/8/15
 
Portfolio 2011
Portfolio 2011Portfolio 2011
Portfolio 2011
 
Announcements, 8/12/12
Announcements, 8/12/12Announcements, 8/12/12
Announcements, 8/12/12
 
Spatial Thinking and Stem Education: Drawing and Mapping with New Technologies
Spatial Thinking and Stem Education: Drawing and Mapping with New TechnologiesSpatial Thinking and Stem Education: Drawing and Mapping with New Technologies
Spatial Thinking and Stem Education: Drawing and Mapping with New Technologies
 
Announcements, 8/17/14
Announcements, 8/17/14Announcements, 8/17/14
Announcements, 8/17/14
 
Announcements, 8/30/15
Announcements, 8/30/15Announcements, 8/30/15
Announcements, 8/30/15
 

Similar a Ft10 de smet

Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) DataCategory theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Datagreenwop
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for AndroidTomáš Kypta
 
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopSages
 
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemWprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemSages
 
The Road To Reactive with RxJava JEEConf 2016
The Road To Reactive with RxJava JEEConf 2016The Road To Reactive with RxJava JEEConf 2016
The Road To Reactive with RxJava JEEConf 2016Frank Lyaruu
 
WattGo: Analyses temps-réél de series temporelles avec Spark et Solr (Français)
WattGo: Analyses temps-réél de series temporelles avec Spark et Solr (Français)WattGo: Analyses temps-réél de series temporelles avec Spark et Solr (Français)
WattGo: Analyses temps-réél de series temporelles avec Spark et Solr (Français)DataStax Academy
 
OrientDB - The 2nd generation of (multi-model) NoSQL
OrientDB - The 2nd generation of  (multi-model) NoSQLOrientDB - The 2nd generation of  (multi-model) NoSQL
OrientDB - The 2nd generation of (multi-model) NoSQLRoberto Franchini
 
.NET Database Toolkit
.NET Database Toolkit.NET Database Toolkit
.NET Database Toolkitwlscaudill
 
NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020Thodoris Bais
 
Full-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsFull-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsMichael Lehmann
 
Akka.NET streams and reactive streams
Akka.NET streams and reactive streamsAkka.NET streams and reactive streams
Akka.NET streams and reactive streamsBartosz Sypytkowski
 
Working with data using Azure Functions.pdf
Working with data using Azure Functions.pdfWorking with data using Azure Functions.pdf
Working with data using Azure Functions.pdfStephanie Locke
 
Don't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax TreesDon't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax TreesJamund Ferguson
 
Toub parallelism tour_oct2009
Toub parallelism tour_oct2009Toub parallelism tour_oct2009
Toub parallelism tour_oct2009nkaluva
 
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklum Ukraine
 
Android RenderScript on LLVM
Android RenderScript on LLVMAndroid RenderScript on LLVM
Android RenderScript on LLVMJohn Lee
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Juan Pablo
 

Similar a Ft10 de smet (20)

Rx workshop
Rx workshopRx workshop
Rx workshop
 
Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) DataCategory theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Data
 
Solr @ Etsy - Apache Lucene Eurocon
Solr @ Etsy - Apache Lucene EuroconSolr @ Etsy - Apache Lucene Eurocon
Solr @ Etsy - Apache Lucene Eurocon
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for Android
 
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache Hadoop
 
Lambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter LawreyLambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter Lawrey
 
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemWprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
 
The Road To Reactive with RxJava JEEConf 2016
The Road To Reactive with RxJava JEEConf 2016The Road To Reactive with RxJava JEEConf 2016
The Road To Reactive with RxJava JEEConf 2016
 
WattGo: Analyses temps-réél de series temporelles avec Spark et Solr (Français)
WattGo: Analyses temps-réél de series temporelles avec Spark et Solr (Français)WattGo: Analyses temps-réél de series temporelles avec Spark et Solr (Français)
WattGo: Analyses temps-réél de series temporelles avec Spark et Solr (Français)
 
OrientDB - The 2nd generation of (multi-model) NoSQL
OrientDB - The 2nd generation of  (multi-model) NoSQLOrientDB - The 2nd generation of  (multi-model) NoSQL
OrientDB - The 2nd generation of (multi-model) NoSQL
 
.NET Database Toolkit
.NET Database Toolkit.NET Database Toolkit
.NET Database Toolkit
 
NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020
 
Full-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsFull-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.js
 
Akka.NET streams and reactive streams
Akka.NET streams and reactive streamsAkka.NET streams and reactive streams
Akka.NET streams and reactive streams
 
Working with data using Azure Functions.pdf
Working with data using Azure Functions.pdfWorking with data using Azure Functions.pdf
Working with data using Azure Functions.pdf
 
Don't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax TreesDon't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax Trees
 
Toub parallelism tour_oct2009
Toub parallelism tour_oct2009Toub parallelism tour_oct2009
Toub parallelism tour_oct2009
 
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForce
 
Android RenderScript on LLVM
Android RenderScript on LLVMAndroid RenderScript on LLVM
Android RenderScript on LLVM
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#
 

Último

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
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 DiscoveryTrustArc
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
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...DianaGray10
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
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...Miguel Araújo
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
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 RobisonAnna Loughnan Colquhoun
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 

Último (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
+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...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
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...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
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
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 

Ft10 de smet

  • 1.
  • 2. LINQ, Take TwoRealizing the LINQ to Everything Dream Bart J.F. De Smet Software Development Engineer Microsoft Corporation
  • 3. What’s LINQ?A historical perspective 5 years ago Little recent innovation Where’s the cloud? Censored
  • 4. Essential LINQLanguage Integrated Monads Why? What? How?
  • 5. Could there be more? Essential LINQThe monadic Bind operator IEnumerable<T> IQueryable<T> new[]{ 42 } IEnumerable<T> SelectMany<T, R>(this IEnumerable<T> source,Func<T, IEnumerable<R>> selector) SelectMany Also see www.codeplex.com/LINQSQO for “Project MinLINQ”
  • 6. Essential LINQMaybe monad (for fun and no profit) Null-propagating dot string s = name?.ToUpper(); One single library function suffices Syntactic sugar name.SelectMany( _ => _.ToUpper(), s => s) from _ in name from s in _.ToUpper() select s Compiler
  • 7. Essential LINQ Bart J.F. De Smet Software Development Engineer Cloud Programmability Team demo
  • 8. Query Providers RevisitedWhy do we have IQueryable<T>? Does it really have to be a runtime check? Implements IQueryable<T> varsrc = newQueryProvider<Product>(); varres = from p insrc wherep.Price > 100m groupp byp.Category; foreach(var p in res) Console.WriteLine(p); Compiles fine
  • 9. Query Providers RevisitedLeveraging the query pattern varres = from p insrc wherep.Price > 100m groupp byp.Category; Syntactic sugar varres = src .Where(p => p.Price> 100m) .GroupBy(p => p.Category); No GroupBy“edge” Can be instance methods Select Where Source<T> Filtered<T> Projected<T>
  • 10. Query Providers RevisitedTaking it one step further Recipe Method overloads Type state machine Operator overloads varres = fromtweet intwitter where tweet. == “Bart” From About From Location From == “LINQ” where tweet. About About About Location select tweet; Query “learns” From operator overloading “Has a” type classTwitter { publicTwitterByFromWhere(Func<TweetAboutFromLoc, FilterFrom> filter); // Other filter methods } classTwitterByFrom { publicTwitterByAboutFromWhere(Func<TweetAboutLoc, FilterAbout> filter); // Other filter methods // Fields with current filters } Custom syntax trees
  • 11. Query Providers Revisited Bart J.F. De Smet Software Development Engineer Cloud Programmability Team demo
  • 12.
  • 14. XNA 3.1 for XBOX and Zune
  • 15.
  • 16. Asynchronous Data AccessEssential interfaces interfaceIObservable<outT> { IDisposableSubscribe(IObserver<T> observer);} interfaceIObserver<in T> { voidOnNext(T value); voidOnError(Exception ex); voidOnCompleted(); } Both interfaces ship in the .NET 4 BCL
  • 17. IQbservable<T> LINQ to WMI Events How? ToQbservable Translatable (Expression trees) IQueryable<T> LINQ to SQL ToQueryable LINQ to *.* AsObservable Homo-iconic AsEnumerable AsQbservable AsQueryable ToObservable IEnumerable<T> LINQ to Objects IObservable<T> LINQ to Events Fixed (MSIL) ToEnumerable Pull(interactive) Push (reactive) What? Duality Concurrency(IScheduler) Where? Message loops Distributed Worker pools Threads
  • 18. IObservable<T> Asynchronous Data AccessIQbservable<T> interfaceIQbservable<outT> : IObservable<T> { ExpressionExpression { get; } TypeElementType { get; } IQbservableProvider Provider { get; } } interfaceIQbservableProvider { IQbservable<R> CreateQuery<R>(Expression expression); } We welcome semantic discussions. Extended role for some operators No Execute method
  • 19. LINQ to WMI Events (WQL) Bart J.F. De Smet Software Development Engineer Cloud Programmability Team demo
  • 20. Asynchronous Data AccessC# 5.0 and VB 11.0 “await” One versus many? IObservable<T> interface – many results Task<T> concrete class – one result Task<T> based language feature Rx bridge by implementing the “await pattern” IAsyncEnumerable<T>
  • 21. Asynchronous Bridge for C# and VB “await” Bart J.F. De Smet Software Development Engineer Cloud Programmability Team announcing
  • 22. Where execution happensIScheduler interface System.Concurrencyin System.CoreEx Introduction of concurrency interfaceIScheduler { DateTimeOffsetNow { get; } IDisposable Schedule(Action action); IDisposable Schedule(Actionaction, TimeSpandueTime);} ToObservable IObservable<T> IEnumerable<T> ToEnumerable Synchronous Asynchronous
  • 23. Where execution happensIScheduler specifies “where” Imported TextBoxTextChangedevent var res = from word ininput.DistinctUntilChanged() .Throttle(TimeSpan.FromSeconds(0.5)) from words in lookup(word) select words; Asynchronous web service call Indicates where things run Use of scheduler to synchronize res.Subscribe(words => { lst.Items.Clear(); lst.Items.AddRange((fromwordinwords selectword.Word).ToArray());}); res.ObserveOn(newControlScheduler(frm)).Subscribe(words => { lst.Items.Clear(); lst.Items.AddRange((fromwordinwords selectword.Word).ToArray());});
  • 24. Where execution happensIScheduler parameterization Baked in notion of “where”? Entry-point for the schema Custom schedulers could be very rich (e.g. server farm) varctx = new NorthwindDataContext(); var res = from product inctx.Products whereproduct.Price > 100m selectproduct.Name; Decoupled “what” from “where” foreach(varproduct inres.RemoteOn(newSqlScheduler(“server”))) // Process product
  • 25. Where execution happensExpression tree remoting Rx .NET fromtickerinstocks whereticker.Symbol == “MSFT” selectticker.Quote Observable data source JSON serializer Retargeting to AJAX RxJS stocks .Where(function (t) { returnt.Symbol == “MSFT”; }) .Select(function (t) { returnt.Quote; })
  • 26. Remoting of Query Operators Bart J.F. De Smet Software Development Engineer Cloud Programmability Team demo
  • 27. LINQ to the unexpectedConstraint solving Non-persistent Model[ Decisions[Reals, SA, VZ], Goals[ Minimize[20 * SA + 15 * VZ] ], Constraints[ C1 -> 0.3 * SA + 0.4 * VZ >= 2000, C2 -> 0.4 * SA + 0.2 * VZ >= 1500, C3 -> 0.2 * SA + 0.3 * VZ >= 500, C4 -> SA <= 9000, C5 -> VZ <= 6000, C6 -> SA >= 0, C7 -> VZ >= 0 ] ] fromminctx.CreateModel(new { vz = default(double), sa = default(double) }) where 0.3 * m.sa + 0.4 * m.vz >= 2000 && 0.4 * m.sa + 0.2 * m.vz >= 1500 && 0.2 * m.sa + 0.3 * m.vz >= 500 where 0 <= m.sa && m.sa <= 9000 && 0 <= m.vz && m.vz <= 6000 orderby 20 * m.sa + 15 * m.vz selectm Cost / barrel Refinement % Max # barrels Min # barrels To compute call Solve
  • 28. LINQ to the unexpectedJoining with reactive sources Observabledata sources fromcostSAinGetPriceMonitor("SA") fromcostVZinGetPriceMonitor("VZ") fromminctx.CreateModel(new { vz = default(double), sa = default(double) }) where0.3 * m.sa + 0.4 * m.vz >= 2000 && 0.4 * m.sa + 0.2 * m.vz >= 1500 && 0.2 * m.sa + 0.3 * m.vz >= 500 where0 <= m.sa && m.sa <= 9000 && 0 <= m.vz && m.vz <= 6000 orderbycostSA* m.sa + costVZ* m.vz selectm SelectMany Subscribe here! Parametersto decision
  • 29. Theorem Solving using Z3 Bart J.F. De Smet Software Development Engineer Cloud Programmability Team demo
  • 30. What’s LINQ?A futuristic perspective Next 5 years Scheduler Remoting Solvers Rx and Ix are here! Toolkits Async Censored
  • 31. © 2010 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.