Search code examples
javascriptjqueryangularjsbackbone.jsember.js

Benefits and drawbacks of using client side frameworks


We are starting to use JavaScript more and more in our projects to improve the client experience. Currently most of our site posts back for just about every user interaction. We mostly use JQuery and plain JavaScript on the client with Asp.Net on the server. Things have started getting very messy and unorganized on the client.

I was thinking of choosing a client side framework like Knockout, Angular, Ember or Backbone to introduce some kind of structure to our client side development. Especially now when it is still early and the JavaScript isn’t a complete disaster. I was wondering if there are any drawbacks from using a client side framework and if we should just stick to using JQuery. Also what would we gain from using a client framework?


Solution

  • Recent Javascript frameworks can help architect your code so that it is modular (therefore reusable), DRY, readable, performant and secure and most importantly cohesive as well as easy to understand. jQuery is not a framework, so it doesn't help in these regards. We've all seen the typical bulks of jQuery spaghetti code. This isn't jQuery's fault - it's the fault of developers that don't know how to architect code. However, if the devs did know how to architect code, they would end up writing some kind of minimal "framework" to provide the foundation (architecture, etc).

    The problem here is that we should not forget that jQuery code slowly and steadily becomes so bulky and unstructured that you'll probably run from editing it. However, using any of the frameworks that you listed out [and some more of them] will definitely give you some added advantages.

    Here are some things that modern frameworks are providing:

    Templating

    Data-binding

    routing (single page app)

    clean, modular, reusable architecture

    security

    additional functions/features for convenience

    Hence in short and sweet manner, go for one of the frameworks that you listed [Personally, i use and prefer AngularJs]