Hacking david.js and few words of dependencies

David is one fantastic project that somehow draws my attention.

There’s probably 2 reasons for this. First, it was the first project where I submitted some code over GitHub. Second, I’ve always been fascinated by the seeming chaos and mesmerizing scope of software nowadays: we’re easily looking at beasts sized at least several thousands of lines of code, often even something like a half a million or million lines of code. How the hell we’re able to pull off the stunts? I mean, it basically sounds on the outskirts like pure madness. However, there’s some shared communal logic which especially now, in the days of readily available source code beyond our wildest dreams, starts to emerge and sorts out the individual packages so that everyone has its own place.

JavaScript history, like it was the Finland-Sweden in 1995

“Den glider in!”

I know that you’re looking for a fresh view to how the Great JavaScript Boom of ~201x happened, so… OK, I know you’re not looking tohear that, but for the sake of completeness, it just has to go here:

Oh, sit down, Josh. You too, Sara. We’re about to embark on a fascinating story into the land of unicorns and hipsters.

1996 Netscape Communications. 10 days time from inception to release. Brendan Eich. Great success hack.

Next: 14 years of mainly onMouseOver shite. Nothing significant.

2010 onward: probably some mutant material hit Earth, and JavaScript evolution got miraculously started. The language gathered an ever-increasing wide audience with soon unbelievable hype and fervor. In 2015 if you didn’t know JavaScript there was 0 jobs for you. Ok, a bit of exaggeration. Not much.

Starting from somewhere around 2011 the world of JavaScript knitting got a big kick in the butt with npm.

Sometimes the landscape of programming has epic battles, but this time it was something very benign. You see, ‘npm’ is the Node Package Manager (or something like it, anyways). All other programming languages, and most notable, PHP and (heck, is there any other remarkable web dev language… Oh, yes, Ruby/Rails of course) Ruby had their neat package managers.

JavaScript was on its haphazard way to become newly minted emperor of the web. At least on the front-end side. JavaScript stumbled somewhat however on the ease of use; well, in fact, it had a few places that slowed the path to success: its rather peculiar sparseness (ie. the lack of powerful language features that had been bread and butter for years in other languages), and it also clearly lacked a simple way to “include shared libraries”.

All JavaScript methods of ‘library inclusion’ back in 2012-2014 were sort of a bad hack; some of those hacks were so weird that one would assume only the original inventor knew how they worked.

(Some of the history of JavaScript and importing is in this article)

Anyways, during this heyday of innovation npm had a social calling: it just fit like a glove.

..and the runner-up is…

So, let’s get a rehash: “npm” became one of the most essential tools for JavaScript coders – it installs, updates and enables all kinds of management around JavaScript packages. Most developers benefit from npm as in the role of “clients” – being package consumers. Others will be using npm to publicize their own packages.

With npm, you could easily test out ideas as a developer; by borrowing code, testing it out in your own piece of code, and if you were dissatisfied with that particular package, just uninstall it and go again with another one. npm would track your dependencies in a file called package.json

What about ‘david’ ?

In plain English, ‘david’ simplified a very arduous and ugly process of manually hunting and installing zipped JavaScript packages. david builds on top of npm, by using npm’s API. David has a few interesting functionalities:

  • check the current state of project’s packages (dependencies)
  • update selectively some package, or
  • update all outdated packages

Be back, soon!

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: