Charlie Calvert, Community Program Manager for the Microsoft C# team, currently focuses his technical energies on LINQ. He has periodically worked with LINQ Chief Architect Anders Hejlsberg both during the development of Delphi and during the development of LINQ. Calvert’s ten technical books have sold more than 100,000 copies. They include Delphi 4 Unleashed, C++Builder 3 Unleashed, Delphi 2 Unleashed, Teach Yourself Windows 95 Programming in 21 Days, and Teach Yourself Windows Programming.
Dinesh Kulkarni is a Senior Program Manager on Microsoft’s .NET Framework team. He was the Program Manager in charge of LINQ to SQL. He was deeply involved in LINQ’s planning and implementation from the incubation stage and was lead author for MSDN’s authoritative LINQ to SQL paper. Before joining Microsoft, he worked in diverse technical roles ranging from architecting and implementing front-end CASE tools for IBM to designing databases and middleware for a Wall Street hedge fund.
For years I have been fascinated with the differences between general-purpose programming languages and databases. Practically every enterprise application built today is coded in a general-purpose programming language and talks to a database, yet the two ecosystems are amazingly different and quite poorly integrated—the impedance mismatch between object-oriented programming and the relational model is the gift that keeps on giving when it comes to application complexity.
But the thing I find particularly puzzling is the lack of query capabilities in general-purpose programming languages. Why is it you can query database tables but not in-memory objects? Why are XPath and XQuery so arbitrarily different from SQL? Why is it so hard to transform data between the object, relational, and XML domains? These are the kinds of questions that launched us on the Language Integrated Query (LINQ) journey. Along the way we got wise to the wonders of functional programming, lambda expressions, type inference, monads, O/R mapping, and all sorts of fascinating computer science. Fortunately, we managed to boil our learnings down to a set of pragmatic language features and APIs that are useful in practically any .NET application.
LINQ extends the .NET Framework and programming languages with a uniform model for querying and transforming in-memory collections, relational data, and XML documents. With LINQ, C# 3.0 and VB 9.0 gain the expressive power of SQL and XQuery to become the first general-purpose programming languages to natively support queries and transformations over all classes of data.
LINQ was a very interesting and unique project to work on. One reason is that it wasn’t just about language features. In order to gain experience with the query capabilities we were developing, we needed to validate them against the important data domains—objects, relational, and XML. That led us to create the LINQ to Objects, LINQ to SQL, and LINQ to XML APIs, all of which were built alongside the language features. The synergy and agility we got from having a joint team working on both language and APIs was just amazing—and loads of fun!
Also, LINQ isn’t just a single monolithic language feature, but rather a collection of several smaller and individually useful features—such as lambda expressions, extension methods, expression trees, object initializers, and anonymous types—that all come together to form the concept of Language Integrated Query. This made our work much more relevant and leveraged.
Finally, LINQ is big step toward a more declarative style of programming. This may be subtle, but it is really important. Programs written in today’s imperative programming languages are too much about the “how” and too little about the “what.” We tend to over-specify the solutions to our programming problems—for example, by deconstructing queries into for loops, if statements, manipulation of temporary collections, and so on. By the time such programs run, it is all but impossible for the execution environment to “understand” what they do. The higher level semantic meaning has been lost in a sea of imperative, low-level instructions that must be blindly executed in exact sequence. This contrasts with LINQ queries, which preserve the programmer’s exact intent and allows the execution infrastructure to be much smarter. A great example here is the Parallel LINQ (PLINQ) API that parallelizes query execution on concurrent hardware with practically no changes required to the source code.
Of course, the creation of a new technology such as LINQ is really only the first part of our job. The next step is to find ways to explain our new technology to the world of developers.
Essential LINQ is an important book because it provides a clear, easy-to-understand explanation of what LINQ does, how it does it, and the many practical ways you can use this technology to make your daily programming life easier and more productive.
Both authors of this text bring an important set of skills to this project. Throughout the development of LINQ, I worked daily with Dinesh Kulkarni in this role as Program Manager for the LINQ to SQL project. Few understand LINQ to SQL better than Dinesh, and the many insights he provides into LINQ will prove to be an invaluable tool for any reader of this book. The chapters Dinesh contributed to this book will be a resource that developers will frequently mine for their rich, well-thought-out content.
I’ve known Charlie Calvert since we worked together on Turbo Pascal and Delphi at Borland International. Charlie is an accomplished author with a gift for finding the key threads in a technology and explaining them to readers in a clear, easy-to-understand prose style. He is also one of nicest people I’ve met.
Charlie and Dinesh each bring important skills to this project that have enabled them to create an excellent book that shows how LINQ works and the many practical ways you can use it in your daily development process.
© Copyright Pearson Education. All rights reserved.