Dinosaurs don't use NPM

Posted by Guido on January 12, 2016 - programming , nodejs , npm

When comes to programming I’m a dinosaur, a Stegosaurus maybe. As developer I used different languages but I consider myself proficient in C# and JavaScript. When I say C# I mean .NET, because apart from the language syntax the real value is the knowledge of the available classes and methods (for example the LINQ provider).

Regarding JavaScript I consider myself a purist, I started web development in 2000 with the LAMP stack (WIMP actually because PHP had an ISAPI module for IIS) and 16 years ago the Web was different, it was normal to write manually the HTML, CSS and JavaScript code with the help of an editor in order to avoid syntax mistakes or preview the changes (I’m a big fan of Topstyle btw, sadly the development is now stopped).

In my work I still need to write JavaScript but it’s limited to some aspects, I need to use a specific framework with rare DOM manipulations so normally I don’t use fancy modern libraries. This makes me a dinosaur in the JavaScript world.

Today I just read this post on Medium

The Sad State of Web Development

The author uses a strong language but from the first lines I understood his points, because I face them often. Most developers (including myself) have this routine:

  1. I need a piece of code in order to do X
  2. I google and I find library Y
  3. I like library Y but after a couple of hours library Y is not enough for my needs
  4. If the descrepancy is small and the source is available I fork library Y
  5. If the descrepancy is big I throw away library Y and I code from scratch

Let’s say we are lucky and the library suits perfectly. After few months I need to modify the code or I must update a dependency, the castle starts to fall apart. Real dev situation: DropNet.

DropNet is a fantastic .NET library to interact with Dropbox, few lines and you are ready to go. The downside is that DropNet rely on RestSharp, a precise version of RestSharp.

The NuGet package says under Dependencies RestSharp ( 105.0.1).

The is a lie, if you update RestSharp to a newer version (because another project requires it) DropNet will throw an exception.

This was the first point, everytime you rely on something you didn’t create you need to consider the hidden cost. 95% of the time you will not have problems, the remaining 5% normally is balanced by the time the library saved you compared to the time you spent to fix the issue. If you spent more time fixing external components than actually use them you learned a lesson (and I learned a lot in this way).

The second point is the way took by JavaScript developers and contributors. I want to say something first: we must be always thankful to the free contributions of developers, GitHub projects, StackOverflow, you name it.

But I’m a dinosaur, a slow one, and I want simple things. Another real dev situation happened few days ago: Lightbox.

For my previous post I needed a library to show some pictures, I used Lightbox in the past but I wanted to try something new, then I googled and I found PhotoSwipe.

Looks nice, GitHub link, source code available. I read the readme and I see

  • NPM: npm install photoswipe.
  • Bower: bower install photoswipe.

I think (because I’m a dinosaur): “why I need to install all the nodejs stuff in order to get a client library, just give me the code and I can attach to my template.”

I downloaded the code but the structure of the library made me switch instantly to Lightbox. Lightbox is also available for NPM and Bower, but the instructions to setup the library with just the source code are available in the main page: copy the files inside your folder, refer the files in your code, add one tag and you are ready.

Of course mine are just two examples and the use of NPM (or Bower or Angular, you name it) gives you many advantages, but we need to consider that not all the developers use the last technologies or they are able to follow the trends. Many dinosaurs developers write code because they have a full-time job, not just for fun. Try to tell to a classic ASP dev “tomorrow you start to rewrite all the application using Node.js”, probably he will like Node.js but definitely not in the first two weeks.