Book Review: LINQ in Action


“LINQ in Action” (by Fabrice Marguerie, Steve Eichert,
Jim Wooley, and Matt Warren (Foreword)) from
Manning publishing.




Disclamer: I am a friend of Fabrice Marguerie, one of the co-author, and I helped proof-read some
chapters dedicated on C#/VB.NET LINQ.


So my opinion might be
biased. But also it means that I have a
bit an insider eyes. And I can tell that the amount of work was huge to make
sure to provide and in-depth coverage of the technology. The authors spend a
lot of time on LINQ betas and CTP versions to make sure to understand and
explain properly every tricky aspects (although the book is
fully compliant to LINQ final version). As a result if you are already acquainted
with LINQ and C# functional advanced stuff (lambda/closure/anonymous
methods/iterators…), you will be delighted to see coverage of in-depth topics such
as how and when to implement IQueryable<T>, performance benchmarks or LINQ
usage design guidelines.


What if you are
beginners or just want to learn LINQ from scratch? I think that the authors made a great job
at writing a book that can be read from cover to cover. The book begins with
some reminders on LINQ history to understand where LINQ is coming from and why
it is making life as a .NET developers more easier. Then come the language
explanations, the part where you will see how C# and VB.NET have been tweaked
to support LINQ syntax (btw, the book covers both C# and VB.NET LINQ and it is great
to compare the different choices made). This part is really essential if you
are considering using LINQ. Indeed, LINQ is coming from functional languages,
something that most of us are not acquainted with, and it is disturbing at the
beginning to understand things such as deferred execution. I found that a lot
of energy has been put in pedagogy for readers that come with a classical OOP background.


Then comes the Part 2
on LINQ to object. This part is also vital because you will quickly realize
that LINQ  is about to definitely change
the way your C# or VB.NET code looks like. Most of the algorithms we code rely intensively on
collections and LINQ to object represents an incredibly powerful syntax to work
with collections. Here also the authors worked really hard to explain properly the
why/when/how to things and to
anticipate just in time the questions
you might have.


Then comes part 3 and
4, on the 2 major LINQ flavors: LINQ to SQL and LINQ to XML. They represent a
great opportunity to see some real-world use of what you’ve learnt in the 2
first parts. What I really liked here is that the authors anticipate the various scenarios (both common and advanced) you will face by using these 2 implementations
of LINQ.


Then comes the great final, the
part 5 that focus on how to extend LINQ to your own needs. LINQ is
coming with several different extension points, from the single operator
rewriting that will take you 2 minutes to write to the complete query framework
that will take months to be written. This part explains and compares all these
possibilities and can, alone, motivate you to buy the book if you plan to
extend LINQ. LINQ extensibility is followed by another great chapter named LINQ in every layer that put up together all knowledge presented until there to see how real-world applications
are impacted by LINQ.


Something I would like
to underline is that authors kept an objective eyes on LINQ. They warn you about
the temptation to use LINQ for everything. What is awesome is that in a wide range of cases
LINQ represents both a new powerful syntax and also offers optimal performance. But
for some other cases LINQ will execute much more slowly than a good old foreach style programming.


I highly recommend learning
and using LINQ now because a lot of things is going to happen soon with LINQ,
with things such as Parallel LINQ (PLINQ, to write queries that will execute on
several threads at a time) , LINQ to Xsd (to write strongly typed XML queries),
the ADO.NET Entities Framework (the Microsoft answer to O/R mapping) and more.


Finally let’s mention
that the book has a dedicated website
 where you can speak with authors and where you can
keep an eyes about new things happening around LINQ, such as this cool visual LINQ
execution facility
by Jon Skeet.


This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.