Posted by: rcosic | 11/02/2009

LINQ – Language Integrated Query in C# 2008

Title: Pro LINQ – Language Integrated Query in C# 2008
Author: Joseph C. Rattz, Jr.
Publisher: Apress, 2007.

Overall mark: very good

Well, I can’t give a bad mark if the book has very high review scores. It is for a reason, though.
The author is very well experienced in this topic, and very well explains it. Also, what I found intriguant and uncommon, it has some personal-style of writing, which makes the reading more smooth and sound.
And what makes the book a little bit bad is the structure of chapters.
Of course.. Actually, I didn’t find any decent book lately which has that. Phew!

The book is divided into one plus four large blocks, an introduction block, following by the blocks each depicting one of the LINQ’s implementations:

  • PART 1: (let’s call it) INTRO
  • PART 2: LINQ to Objects
  • PART 3: LINQ to XML
  • PART 4: LINQ to DataSet
  • PART 5: LINQ to SQL

So far – so good! And, bravo for omitting the appendices!
After that, unluckily, the topics are little bit meshed up.

Part one is written very nice; it includes an everlasting HelloWorld application, and C# 3.0 language enhancements created just for LINQ. The first examples are really good, describe well in just couple of lines what is all about. Also, I’m very fond of the tought that also author has, and that is, LINQ is quite unfamiliar for the developers except for SQL usage. He follows with some tips and tricks (perhaps too early), and then with the language enhancements of C#. As I’ve said, this chapters are very well written and if the author just stick to this schema, he could done the terrific job…

Now comes the LINQ to Objects, actually the essence of the LINQ and therefore must-be key part of the book. It was not necessary, though, to split the chapters like they are: LINQ to Objects Introduction doesn’t bring anything else but nine pages (including a table and a summary) and it is too small to take a grasp. But it is very good written indeed. After that, you are presented by the deferred operators, following by non-deferred operators. Also, very good explained. Actually, too much about it! From here goes the spreading the topics on too many pages, and therefore, becoming quite boring…
For each operator every possible prototype is explained, along with the examples. The code snippets and console printouts are not necessary. After all, the topics are self-explanatory as they are. Nevertheless, it is nice to read them and pass through them (120 pages!).

In the third part, LINQ to XML, not surprising, the introduction is the first chapter. Also, to short. It has six pages in print and it doesn’t enlist all the parts of it but rather just one example. After that, significant API design enhancements are presented: XML tree construction with functional construction, element centricity, names, namespaces, prefixes, nove value extraction. All good. The LINQ to XML object model is depicted afterwards (maybe it would be good idea to put it on the very beginning of the chapter), along with deferred query execution, node removal, and the so-called Halloween problem. I must confess, really good written.
And now, unfortunatelly, comes a boring part – enumerating the XML objects and giving the examples. As with the operators, too much of explaining – it is straightforward and not necessary to explain them further (cca 65 pages).
Extension methods (LINQ to XML operators) chapter also enumerates the stuff a little bit too broad, and then we are reading Additional XML Capabilites. Queries, transformations (XSLT) with tips, validation of the schema, XPath.. thumbs up!

LINQ to DataSet was a mystery to me, but luckily, the topic is very good explained and it solves that mystery good. I never thought that LINQ to DataSet is so useful. By using a couple of added operators, such as Distinct, Except, Intersect, Union, you can make your datasets even smarter. Playing with DataRow field operators also brings joy, as well as DataTable operators, and more over, typed DataSets. Very good.

LINQ to SQL is the most interesting part because it deals with the concrete and practical implementation of the LINQ, and that is – a database. More specific, a SQL Server database. The chapters explain large scale of topics, and it is tricky to sort it out by chapters. So, I take it lightly to criticize.
The introduction is very good, it presents all the paradigm in just a few pages: connecting, updating mechanism, the DataContext class, entity classes, associations, concurrency conflict resolution, SQLMetal command-line tool, Object-Relational Designer – everything what you actually need!
And there comes the chaos. Instead of presenting DataContext class first, followed by LINQ to SQL entity classes (because they are physical part of the DataContext), then LINQ to SQL operators (that is, manipulating with the entity classes), and then other stuff at the end, the author decided to give somewhat confusing order of themata, but I must confess, all the topics are very well explained and concise:

  • LINQ to SQL Introduction
  • LINQ to SQL Tips and Tools
  • LINQ to SQL Database Operations
  • LINQ to SQL Entity Classes
  • The DataContext
  • Concurrency Conflicts
  • Additional SQL Capabilities

Up to this date, I didn’t find any ‘black-yellow’ book (published by Appress) about ADO.NET Entity Framework.
This is sad, as I’m currently searching for some good book in that topic, and the books I’ve found are just too nasty for me to grasp…

Nice reading!

Advertisements

Responses

  1. thanks


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: