Software Abstractions

Abstrations are hard to debug, require a learning curve of 2x the original problem and are rarely complete.


This was part of a comment left on Hacker News to a post about Coffeekup. Coffeekup is a CoffeeScript abstraction over HTML. Just like HAML. The beauty of the comment is how concise it is to the real problem with abstractions.

Abstractions are key to developing good software libraries. They are shortcuts for what otherwise might be lines and lines of code. The jQuery JavaScript library is a great abstraction over JavaScript. It takes what would be tons of “document.querySelectorAll(‘selector’)” kinds of code and distills it down to “$(‘selector’)”. This is a good abstraction because it’s JavaScript over JavaScript.

And in many cases developers will build libraries of abstractions in the name of “platform”. That is to say that you can create a platform for building software based on a frameworks full of these kinds of abstractions. An example might be to use Google Web Toolkit to build web pages which would allow you to write “everything” in Java, and compile it down to JavaScript.

The quote points out why this is not always the best solution. The reason is simple: It’s Java over JavaScript. Right away the learning curve is 2x the original problem. What you may not be familiar with in JavaScript may only loosely compare in Java due to differences in language. It is much harder to debug – regardless of the debugger provided – because of the native differences in runtime for each language. More importantly, is that it requires more lines of code to achieve the same effect. What is typically a few lines in JavaScript inevitably turns into tens to hundreds of lines of code in Java. The compilation process is so effective that the hundreds of lines of code in Java turns back into those few lines of JavaScript. Which to me argues the benefit. Is there one?







Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: