On frameworks and libraries in Software Development

I woke up this morning with a link to something interesting trending on HackerNews. One of my mentors, Karthik Nandyal, had forwarded it to me.

I also happened to log on to Scaler, a platform where I mentor software developers and saw a bunch of questions from mentees around how to choose the best framework, which one should they be learning etc.

Both of the above got my thoughts racing. We’re in an information overload era and new developers are assuming that they need to master the frameworks to excel at their jobs. (software development)

Let’s look at the triggers in depth:

A lot of the above resonates with my long-term thinking of focusing on underlying languages over fancy new frameworks.

For those who don’t know: Hey.com is a brand new privacy conscious email provider with slick UI and an interesting take on emails and SPAMs. They have gained a lot of traction because of the founder’s previous successes. These guys built the RoR stack. The same framework that eventually powers the backend of platforms like Scaler and InterviewBit. They also built BaseCamp – a really popular Project Management tool.

New developers put too much thought in choosing a framework and comparing apples to oranges. It is worthwhile to “build something”. Most modern frameworks and libraries will let you achieve that goal.

React was miles ahead in architectural thought process when it launched. But today, you could build anything using either Angular or React, or as is in the case of Hey, simpler frameworks like Turbolinks & StimulusJS.

Hey.com stepped aside from the fancy architectures and ended up creating their entire app as a Majestic Monolith – another great read.

If you are a new developer looking to decide on a framework or library then depending upon your aim, you could:

  1. Looking for a job: Identify popular frameworks – build a side project using that. Try and read up on advanced concepts in that framework. Hit StackOverflow questions for the topic and try to see if you understand the day-to-day problems most developers face.
  2. Just want to explore: Pick a framework, any framework/library. Build something. Publish on your GitHub. Pick another, repeat… at the end of it, you’d have learned how to build various things using multiple tools/platforms. This is what a true polyglot developer feels like. They might have hands on knowledge of multiple tools and be experts in only a few.
  3. If the aim is theoretical knowledge by discussion only – you’re doing something terribly wrong. Either do “1” or “2” above and you’d have a good chance at getting yourself a seat at the table.

Remember, the table is large enough to accommodate everyone. Just that, only a few developers actually put in the hard work. No amount of reading about frameworks will teach you anything about the practical aspects of actually building real things.

Knowing a framework in depth, will allow you to talk to other framework folks and work upon your opinion. Having wide knowledge about many frameworks will let you have meaningful conversations with those who have in-depth understanding. It is never a black and white world. There are shades of grey associated with every framework. Work upon your opinions, be malleable at certain temperatures.

If you do not build, you’re just a blank canvas – anyone can throw some paint and change the colour. I’d call that technological-brainwashing.


Origins of JavaScript, or ECMAscript.

ECMAScript (or JavaScript), legend has it, was built in 10 days flat. In the year 1995 when I was 5 years old, Brendan Eich had been tasked with developing a scripting language for the Netscape browser.

Eich took parts of Scheme (first-class functions) and Self (prototypal inheritance) and made the syntax “look-like” that of Java. (of course he did a lot more than just that.)

The language was made for amateur scripters who wrote simple code for client-side execution. Not many had predicted that the language would become a popular choice for building dynamic websites, server side frameworks, databases and even powering drones.

Today, JavaScript is a single-threaded, non-blocking, asynchronous, concurrent language. It features a call-stack, an event-loop, a callback queue and some other APIs. Node has a call-stack and a heap.

JavaScript programmers like to use words like, “event-loop”, “non-blocking”, “callback”, “asynchronous”, “single-threaded” and “concurrency”.

Let us go back in time and see the timeline for JavaScript:

After the initial release in 1997, the first major release came in 1999 called ECMAScript 3. Post which the language was stagnant for a long time. While there was a draft for ECMAScript 4, it was never released due to lack of consensus on the featureset.

During this time, libraries like jQuery helped JS stay sane by handling browser quirks and kinks. Creative users were trying to make beautiful animations and innovative hacks for various tricks. But performance was an issue. Then began the browser performance wars. In a bid to get a bigger market share, browser vendors started optimizing Javascript execution to make run faster.

This led to a dream-run for JavaScript performance. With the launch of V8 in 2008, JavaScript was 10 -1800 times faster than previous generation compilers. This gave the language a resurgence amongst web developers. Latest browsers like Google Chrome, could run client-side scripts at blazing fast speeds. Other vendors soon caught up with their own compilers which optimised code for execution. (JIT)

Developers started handing off non-business critical calculations like template rendering to the client, thereby improving server response times and reducing loads on backend servers. Websites were suddenly faster than ever.

Mr. Douglas Crockford evangelised the language to a big extent, his book “JavaScript – The Good Parts” has eventually become a must read for most beginners.

Crockford also contributed directly to the language, most notably his specification and implementation of JSON. Today, it is the most common data format used for asynchronous browser/server communication, largely replacing XML, and is used by AJAX. AJAX made it possible for single page applications to gain popularity.

In 2009 ES5 was launched with JSON support baked into the language itself. This version also added a ‘strict mode’ aimed at capturing silent errors. According to John Resig – “This strict context prevents certain actions from being taken and throws more exceptions.”

Eventually, Ryan Dahl, a talented developer picked the event-based, non-blocking, single threaded V8 engine, developed by Google, and made Node.js® which is a JavaScript runtime for server side programming. It is inherently lightweight and efficient for non-compute heavy tasks.

As Node started getting popular, a huge ecosystem of contributors started creating and maintaining libraries to host servers, manipulate images or even stream data. Thus npm was born, which today is the largest repository of open-sourced packages in the world.

But all this while, the language itself remained almost the same. ES5 (the most widely supported version of JavaScript currently in use) was standardised in 2009. Since then the “Ecma International, Technical Committee 39” has been working on introducing new features to the subsequent releases.

The committee has since 2015 decided to launch a version of the language every year in the format ES2015, ES2016, ES2017 and so on. Those features which cannot make to the current release get added to the next draft.

So today, JavaScript has a wide array of new features available, which cannot be used in production code since few browsers might not support them.

But, as is always the case, another bunch of geeks have come up with Babel which is a transpiler which can take in any version of JavaScript and emit ES5 which all modern browsers support.

I know we have covered a lot in this post. We would eventually dig deep into the basic fundamentals of the language and then eventually work our way till we know how to read new drafts and know what to expect from future versions of the language. We will also explore various libraries written for client-side (Backbone, Ember, React, Redux etc) as well as back-end execution (Express, Meteor, Kraken etc) and learn how to use a few of them to create modern fast applications which solve real-world problems.

Edits, Tips, Suggestions, Feedback? Please let me know in the comments below.

JavaScript and “First-class functions”.

js-minJavaScript is one of the languages which claim to feature “First Class Functions”. So, what does it mean to be first class function? Let’s explore.

I like to compare it to being a first class citizen. Basically the right to freely move across boundaries in the country without being questioned of your purpose.

In the programming context, being first-class, gives JavaScript functions the ability to be saved in variables, passed around as arguments or even returned from other functions. Taking this a step further, functions can reside inside objects as one of the properties. Continue reading JavaScript and “First-class functions”.