Measure your selection of js frameworks

A common question now-a-days people ask – “Which JS framework should I use or is better?” There are enormous number of posts available on net, “Compare JS frameworks, which one is best?, Why angular is better than others? etc.“, but I think – “are we asking the right question even? do we understand what support we need for the information we want to handle?

I think its better to understand your project first, instead of start googling for this vague answer, which might not fit. If you are starting a new project, would you start with the framework selection process first, or you will write your own custom from scratch or you will use the one you used in your last project or the one you are most comfortable with? lots of questions, which usually arose when we start something new, but what if you join a project which is already in half way baked and the whole team is suffering with the pain with it? What would you do in that case? will you take a step ahead and change it? theoretically or in sunny world example, the answer could be yes, but practically, its quite unacceptable and unreasonable too.

Observations

I have observed that people choose any framework/tool because of –

  • they have used it in previous project and now are a bit more comfortable.
  • they found that so many people are using it, so should they
  • they think its cool to use latest frameworks and if its new it will have more features(it may, but do you need that?)

Measure this example

Let me give you an example of implications of using any random tools/lib/frameworks.

I recently got staffed to a new project(80% done) and project uses knockout, jquery, requirejs, grunt and other stuff. There was a functionality to build that show a modal dialog box. Code uses knockout-jquery-dialog plugin, as it seems a good match with project tech stack. Things went well and functionality was developed and delivered.

Now It was handed over to me to fixing a bug and implementation of minifying/uglifying the JS. I used grunt for that, in later steps I found that even though the project was quite small and the JS file after minification was around 560KB or so, which made me think and asked to dive deep into it. I found that knockout-jquery-ui  (a wrapper on jquery-ui) essentially includes a whole bunch of stuff. when you require knockout-jquery-ui-dialog, it internally calls many knockout-jquery-ui-* libraries, which internally calls respective jquery-ui libs(required for dialog box), so essentially, for one small functionality of a modal dialog box, project was using around 18-20 extra js files (i am not counting the css files as of now), which was causing around 70KB-80KB of minified js, was that worth for? My point is not mainly about size, but mainly around the use, that library provides you lots of functionality but how much of it we are using.

Is jquery-ui bad or knockout wrapper for it? no, they have their advantages, and they have done with fine engineering with lots of things keeping in mind that it supports all primitive browsers also with lots of functionality. lets not go into what are the advantages of it, its proven that it has lots of functionality with primitive browser support.

There are lots of such examples, which you might have also faced sometime. This incident arose a lots of questions to my mind, but the most important question was, do we really need all that is easily available on net? I am not saying that these libraries has some issues, but choosing the right libraries for right purpose is the main challenge. What we do for that? Why it happens? I think the main reason for that is less planning of what is useful and can be used.

Measure the value

Before we talk about planning, lets understand one thing, these frameworks out there are made with good engineering skills and via experts who wants to help people out there who cant code that well and those can leverage the functionality without worrying much about intense knowledge in javascript. If you don’t know what is the right way to do it, try to answer few questions to yourself, like, Do you really need to include this library? Does it have exact features which you need or may be needing in future and not more? Can you customise this library according to your application features? Do you really need two way binding in your project? is that which you can’t manage with vanilla javascript?

For examples, knockout offers Templating, but the flavour of templating offered in Knockout is DOM-invasive, which means, used in a small wrong way can put you in deep shit of refactoring later, so can you develop your own custom templating and use it with it? Ember says “Ember.js incorporates common idioms so you can focus on what makes your app special”, is so vague line, and so lucrative that developers just get attracted and you wont realise this until you are already in deep pain.

Measure your learnings

What impact does using a framework have on your problem-solving capabilities, marketability, and future in this field? It will make some bonus points in your profile adding some frameworks and lots of analytics data shows that recruiters approach with more keywords in profile with exact matches sometimes. Even now-a-days some business require specific skills in some framework as a job requirement and sometimes they neglect your core skills or your engineering skills. I leave the decision on you, which way you want to go for in that area.

I would like to mention that “You are a not developing framework, you are doing way more than that, you are developing application, for which if you want to use some framework/libraries use, you are an expert of system, of things which needs to be used to solve a problem, to develop a feature.” If you are developing some framework, then understanding behind the technology would help you more.

At the end of your project, which side you want to be on, where your employer will appreciate you who gained experience that can be applied to future projects or go in a retro room to retrospect what went wrong?

Measure your impact

I have faced this in a very recent interview I took of a 3 year exp guy, who was using reactjs for sometime and because he found it easy to use, he was totally sold for it, he was not able to answer few basic concepts of JS, but if given he will use reactjs everywhere in the world, be it a small website or a huge enterprise level app or CMS. This made me realise that what impact does it have on our field when newcomers are learning JavaScript frameworks before learning JavaScript, and potentially delaying the learning of core concepts of application development?

I have no complaints about framework developers, you guys are doing just great, a lot to learn from you, but I have concerns about lead developers, mentors, tutorial authors or people answering on StackOverflow, they should really think about the impact it has on the long term engineering capabilities of your co-workers.

There are people who are working on drafting new specs of new awesome features to improve or to take web as a platform to next level, but there are people who are against JS frameworks too.

I leave the final question to you, do you think what we do as developers is enough? do you think that its better choose frameworks/libraries which matches our application or we should create applications around the frameworks as most of them have certain boundaries, whereas your application does not.