Thursday, January 8, 2015

The naive developers application stack

In this modern day and age of JavaScript,things change very rapidly,first we built stuff with jQuery and maybe added a bit of underscore to add a little spice to our application. Now you've moved on, it looks like you crown a new king every other day .

Yesterday you were excited about the prospect of building MV* apps , now you are talking of doing server side javascript and then using server side modules on the client side with npm whatever that means . 

Today , you are excited about this weird angularjs thingy but I do not see the difference between onclick and ng-click and wait,are you placing that script tag in the head.Now,you have module system to manage all the module systems that you built , this is dizzying . I could only wonder about what you want tomorrow,generators to generate generators that wait for other generators perhaps.

You too once used these tools,these are the tools of the naive developer,some one who is beginning their journey into the world of JS:

(i)jQuery(duh):

Every one uses jQuery and everyone recommends that everyone else use it regardless of whether they have used it,heard of it or not. This library is intensely popular with managers as the answer to the statement , the browser cannot do that and it will not work everywhere.

jQuery came into existence because writing DOM manipulation code was incredibly hard while on the other hand,targeting DOM elements for CSS is incredibly easy(the basic selectors are simple and declarative,there are other more difficult to grok css selectors that I have shot myself in the foot with).

It weeds out browser incompatibilities and ensures that your code works across all browsers , this library plays a major role in keeping IE(6-8) alive . If there is something that jQuery cannot do , there is a plugin for it.

(ii) lodash

Functional programming is a major buzzword today in the programming universe , every language is advertising itself as a functional programming language with OO support instead of the other way , functional programming allows the programmer to use beautiful expressions with minimum code.

(iii) Q 

Promises are one of the greatest things about programming in js today,if you have not heard about them,learn about them and starting using them,Promises make your asynchronous requests easier to work with and easier to encapsulate.

(iv) Handlebars/Jade

Handlebars and Jade are templating libraries that allow you to construct custom html with data much more easily,no writing millions of lines of jQuery code that creates a table element,now you have to give the same treatment to each tr and td.You can precompile these Handlebars templates for better loading time.

(v) Browserify:

Browserify sounds like a fine idea to me,but the niggling concern at the back of my head has always been this:

     How the heck do I work with jQuery,bootstrap and certain other libraries using this build tool?

The answer for now,can only be a shim configuration transform provided by browserify-shim which transforms these modules into shimmed modules.

(vi) Express + MongoDB

This is what I use to build my servers and they rarely go work, I have found that working with express is exceptional and rather intuitive.It makes the business of server-side web development very simple,it provides you with routing which I believe is the greatest thing since sliced bread.

I am still fishing around for a good behaviour driven framework to perform tests on both node and the application.Mocha seems highly promising, the jspm and Systemjs modules seem promising but I would like to continue using Browserify for atleast a while now.

The next question for me would be:

          "To stream or not to stream"

Do I use a build tool.which one do I pick and why?There are two options available,Grunt and Gulp,I have setup everything but a proper grunt-watch task.Gulp is fairly new to me and anything I do in it blows up in my face,so grunt is the tool to go to for me.

No comments:

Post a Comment