Tuesday November 24th

Monday November 23rd

The Dark Side of LINQ

I’ve been having mixed feeling for quite some time now regarding LINQ. Sure it can make working with data sources a lot easier and it can definately save a lot of code but it also has the potential of creating cryptic complex code...


While any technology can be abused, the author doesn't make a compelling case. The snippet he pasted is not very readable with or without LINQ.

Using a hammer on a screw....

linq = "language-integrated query".. not "language-integrated parsing"

Looks like only "ryan baldwin" makes a good comment..

The post itself is however an example of "the dark side" of LINQ. It can be "abused" in lots of ways, which only obfuscate things/make them harder to understand when used in an inapproriate context. Too much people seem to think LINQ is the solution for everything...

Sure it is, but the article does not point that out in a good way, making the writer look stupid IMHO.

And too many people thinking linq being the solution for everything.. Who are those people??? I haven't seen, talked or read posts from any abusing linq in this way (well some, but in the right context)

this article is now nothing as you speak. It's about putting linq in context.

Not sure if you are responding to my comments, but let me explain.

No where in his article does he mention, that linq was never supposed to do what he is using it for, and the introduction makes it seems like he is not aware of it.

Yep that code looks like fermented midichlorians...

Hi Duckie,
I never mention that in the article because that claim, that LINQ wasn't meant to do parsing, is questionable - and that's the debate it was meant to provoke.
In fact, I had a dozen far more hideous and longer LINQ statements that query a DB and I didn't include them because I wanted a relatively simple statement that people could easily run on their machines.
These statements are in the "right context", as you define, but they're still complex statement that makes the code much harder to understand and maintain than it should be.

On the other, the programmer sitting next to me in the office (who wrote) sees nothing wrong with them...
I've also heard responses from other programmers that complain that Microsoft just put SQL into C# as a quick solution instead of working on good ORM solution that'll avoid dealing with anything DB (and SQL).

LINQ provokes all sort of opinions and responses from different programmers and the post's purpose was to get such a discussion going.
I think the comments I got are far more interesting than the actual post...


Good response, got to agree with you, except the parsing ;)

Of course some linq-queries are long, as would the sql-queries be. I like the features of link, but i am not sure, if i will ever use linq for sql.

Btw, why comment here and not on the post itself?

Commenting on Stories is limited for now and will open up to those recommended by the community. Learn how
Loading DotNetKicks...
brought to you by the Kicks Network