Should we use libraries?

Backbone.js, Node.js, SASS and even JQuery. We add these libraries in every day to create better websites and faster, but we are just loosing our coding abilities? I wonder with all these libraries that we are creating and importing are basically making our websites for us and, our coding abilities more like setting up WordPress. So should we give in and use them or should we be creative and make our own paths?

When I started coding only a few years ago I was made to code everything from scratch. Apart from things like slideshows and fancy features, but more and more I see recruiters and companies asking for us to know how to use certain imports. We used JavaScript and JQuery to create our own amazing features and to make the websites more interactive. This also then showed more skill as you knew how to read and write hard code. When I now see most jobs are requiring you to know more about other plugins like Backbone.js and Node.js. These languages are meant to make it faster to code and mean that anyone can pick it up to know what you have done. I have tried to see it their way, but I just can not get to grips with why they are so good. I even attempted to code a game in Backbone.js to see if I could see the advantage, but got annoyed learning a whole new language. Instead I, quickly, created the whole game using just JavaScript and JQuery. The game is here if you want to play JS Space Invaders .

I do hear about all the good these languages can do and why they think it is better, which I may learn if I was to have a good chat with a hardcore developer that uses it. Mostly though I think it is the managers that like it as it is new technology. By saying that they are using what is the latest craze at the moment makes the company look like it is at the top of the stack and making new strides, but then all they seem to be doing to me is following the crowds.

//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js

(adsbygoogle = window.adsbygoogle || []).push({});

I can appreciate that it is good for consistency as you can create a pattern for other developers to follow. This goes for things like LESS and SASS as well. The head developer can create a template of how to create each website and then the lower developers will follow it. This is then made easier with the plugins as they already have a standard, like backbone.js using the MVC(or more like MV) pattern that is stardard. With JavaScript you would have to build the rough, bespoke template instead for example:

Backbone:

Model

        Person = Backbone.Model.extend({
              initialize: function(){
                             alert(“Hello world”);
               }
        });
       
        var person = new Person;

 

View

       SearchView = Backbone.View.extend({
               initialise: function(){
                      alert(“Alerts suck.”);
               }
        });

       // The initialise function is always called when instantiating a Backbone View.
        // Consider it the constructor of the class.
        var search_view = new SearchView();

 

JavaScript

       Var ModelNamespace = {
              Function ModelFunctions(){
                      alert(“Hello world”);
              }
       }

       Var ViewNamespace = {
              Function ViewFunctions(){
                      alert(“Hello world”);
              }
       }

These are both the same, but the backbone.js has its MV built into the library. The thing that make Backbone better is that it is standard, so any developer will know what has been done, but the JavaScript you will have to read into the code more. This makes the Backbone.js more readable to the new developers you hire and so faster to get them to the level you want them.

//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js

(adsbygoogle = window.adsbygoogle || []).push({});

The other advantage is speed, which is why most companies go for these libraries as they want things done faster and out the door. The aim of the game is to get as much work done to the best level, so when you have methods of making it faster then you take them. It is the same reason why people go for WordPress as it is prebuilt and very fast to get them out the door. A CSS method most people use is SASS or LESS, which I do like a lot and agree with, but it is still another import. The advantage is the declaration of CSS values to keep consistency to the project and also for easy change of the template. If you was to do the below you can change the colour scheme of the whole website quiet instantly and with minimal effort. Also you would be able to have a consistent box-shadow across the website.

SASS

$font-stack:    Helvetica, sans-serif;
$primary-color: #333;

       body {
               font: 100% $font-stack;
              color: $primary-color;
       }

       a {
              font-size:14px;
              color: $primary-color;
       }

CSS

       body{
              font:100% Helvetica, sans-serif; 
              color: #333;
       }

       a {
              font-size:14px;
              color: #333;
       }

Although it can speed up code in the present, it can slow things down later. If your using a plugin and then there is an update to a browsers or another plugin, then you may not get support. The example of what I had before is Twitter. We were using a Twitter library in our system and then Twitter released the update to oauth. The program we had built in to the system didn’t support this and the developer that built the program didn’t either. This resulted in us not knowing how to correct the issue or source it either. It took us longer then to find another resource to fix the new update, while our service was down for a few weeks. This of course is not except able and the bigger the company the worse the damage. If you build something yourself then you know not just that it is supported, but you also know how it’s built for future work. It can also protect you from bugs. If you now know what code is in your program then you know of any vurualbilities, but if it is not your code then there could be a loop hole that bugs creep in.

Once you have finished your program one of the common problems is the speed, but unlike plugins you don’t have to go shopping for a new one. You can now access your code to then speed it up or to add more features. With plugins you would have to find the right one and be happy with any flaws, unless you are going to read through all their code. This is also if you can read through their code. If the developer has minified it or even worst compressed it then you may not be able to gain access. This is what happened with the Twitter issue above. The code file used was a DLL and so we couldn’t even access to code to find the bug.

When you then bring in things like backbone you need a developer that knows the language. Backbone is basically another language that you will need to know to update any code. This can come hard for recruiting as you will need a developer that is fluent in JavaScript and Backbone. Although it is a big thing and a lot of developers are going with it, you have some great coders that don’t though. This then could limit you to what kind of developers you have.

Although we say this, there is one library we all use and have learnt like another language and this is Jquery. It is over looked as we use it in just about every website, but this is a plugin to make coding faster and it does work. It is neatly compressed and as it is so big there will always be support for it.

Advertisements

Leave a message please

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

WordPress.com Logo

You are commenting using your WordPress.com 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