Stop recommending libraries

Tags: webdevelopment, programming.
By lucb1e on 2012-04-28 15:59:30 +0100

Q: Can someone explain how text ranges work in Javascript?
A: I recommend using jQuery or MooTools for this. [Link to how it's done in Mootools]

Wrong answer.
That's not the answer to the question, that's how you would do it given that you already use a library on your site and you don't really care about how it works. If the asker is not already using a library, it's insane to include 88 (Mootools) or 92 (jQuery) kilobytes of Javascript just to do this, especially when he is asking for an explanation.

Here's what you can do in 96 kilobytes:
http://www.youtube.com/watch?v=2NBG-sKFaB0

Another reason why this is wrong is that you are limiting yourself to the capabilities of the library. You can't write your own code.
Side-story about writing your own code: The day before yesterday a friend of mine had a test at school and had to write code on paper. Afterwards many classmates were complaining how they reflexively tried to use ctrl+space, but of course couldn't since they were writing on paper. They said they just couldn't write anything!
To me this is absolutely hilarious, being so dependent on the computer suggesting the code for you that you can't write anything without its help. But by only using libraries, you are creating the same issue.

Another astonishing comment was when someone was surprised I could download data in Javascript without using any library at all. I just can't fathom how someone can make such a remark...  Well obviously he didn't know it takes just a few lines to do this, but also besides that, it's not like libraries use any magic. You can't do more with a library than without if you're a proficient coder.

Well I can see how this might be the next step. We also don't write much assembly anymore do we? Libraries for scripting languages might be the next step in programming a computer to do something. Still, I feel it's good to know the underlying system.

Don't get me wrong, libraries can be really great. Especially Javascript is a language which is very suited for use in some custom way. People made remarks about Perl before that it looks the same before and after RSA encryption, but it's not hard to do the same in Javascript. Libraries may even get some sane structure to it. The reason I ask to get rid of the "use a library"-answer is because the person asked how something worked, not how he could accomplish something in the easiest possible way. And of course the speed issue you create when including a library capable of doing a load of things just to use one feature.

Edit 23 September 2012:
Related: http://www.doxdesk.com/img/updates/20091116-so-large.gif
lucb1e.com
Another post tagged 'programming': PHP's in_array is slow - this works faster

Look for more posts tagged programming or webdevelopment.

Previous post - Next post