Question

A lot of us started seeing this phenomenon with jQuery about a year ago when people started asking how to do absolutely insane things like retrieve the query string with jQuery. The difference between the library (jQuery) and the language (JavaScript) is apparently lost on many programmers, and results in a lot of inappropriate, convoluted code being written where it is not necessary.

Maybe it's just my imagination, but I swear I'm starting to see an uptick in the number of questions where people are asking to do similarly insane things with Linq, like find ranges in a sorted array. I can't get over how thoroughly inappropriate the Linq extensions are for solving that problem, but more importantly the fact that the author just assumed that the ideal solution would involve Linq without actually thinking about it (as far as I can tell). It seems that we are repeating history, breeding a new generation of .NET programmers who can't tell the difference between the language (C#/VB.NET) and the library (Linq).

What is responsible for this phenomenon? Is it just hype? Magpie tendencies? Has Linq picked up a reputation as a form of magic, where instead of actually writing code you just have to utter the right incantation? I'm hardly satisfied with those explanations but I can't really think of anything else.

More importantly, is it really a problem, and if so, what's the best way to help enlighten these people?

Was it helpful?

Solution

It's basically because programming is fundamentally difficult. It requires a lot of logical, structured thought in a way that a lot of people just don't know how to do. (Or simply can't do, depending on who you listen to.)

Stuff like LINQ and jQuery makes certain common data-manipulation tasks a whole lot easier. That's great for those of us who know what we're doing, but the unfortunate side effect is that it lowers the bar. It makes it easier for people who have no idea what they're doing to start writing code and make things work. And then when they run into reality, and find something fundamentally difficult that their simple, high-abstraction-level techniques are not well suited to, they're lost, because they don't understand the platform that their library is built upon.

Your question is sort of on the right track, but much like the perennial controversy about violent video games "turning kids violent," it has the direction of the link backwards. Easy programming techniques don't make programmers stupid; they just attract stupid people to programming. And there's really not much you can do about it.

OTHER TIPS

To me it's the new toy phenomenon. Something new comes out (LINQ) and now every developer wants to play with it.

They see LINQ as a hammer and every problem is a nail. Who cares if it's simpler to do it another way? LINQ must be the answer! Like when everyone was using XML for EVERYTHING! Configuration file? XML. Storing Data? XML. Etc etc

I think LINQ offers a really good opportunity in C# at solving problems using a more functional approach. We shouldn't dismiss a new style of problem solving just because we already have something that works.

Coming from a heavy SQL background, I like having the option of using set based logic in my C# to better describe the intent of my operations.

That said; context is king, and anything can be overused.

LINQ and jQuery are the latest "toys" and developers love showing off how they can do stuff using the latest thing.

If you use Linq properly, and understand it under the hood, you will find all sorts of new cutting-edge programming techniques.

So if you think deeply about the enhancements, I argue that it makes you a better programmer. Whether a given programmer actually does this or not, is not Linq's fault.

The same argument can be made for Object-Relational Mappers. Does anyone really write raw SQL queries against database tables anymore? :)

Some of those insane things are because people are using the wrong hammer, others are because they are building a really elegant super-hammer, but they have run into an oddball detail that needs to be overcome.

For example, if you see a question about using linq to generate dynamic linq to use against non-dynamic linq nine times out of ten the person is either just curious if it is possible, or barking up the wrong tree, but there are a few things you can solve this way that are difficult to the point of unreasonable to solve otherwise.

I take these sort of questions in two parts:

  1. can it be done, and if so what would it look like
  2. should it be done, is there a risk, or a better alternative

I have found that I almost always do them in that order. It answers the question and also helps you make a better explanation for potential alternatives.

I don't know about any numbing effect on developers' minds but take a look here for the effect of numble-minded tools/languages on rates. Talk about lowering the bar!

I agree with Mason Wheeler. However, it is not entirely crazy to try to solve https://stackoverflow.com/questions/3762202/get-range-of-integers-with-linq by operating on a "sequence". The problem is that Java's and .Net's iterators do not support all 3 operations: current value, next value, and move to next. Clojure can do all 3, and I suspect that in Clojure it is easier to do this right. Python also has co-routines, and I want to try cracking that. http://clojure.org/sequences http://www.try-clojure.org/

In fact, if the input is an infinite sequence, such as http://oeis.org/A007401, then lazy is the only way.

Licensed under: CC-BY-SA with attribution
scroll top