Tuesday, May 20, 2014

Javascript - Intro

Javascript - Intro

So in development right now there is a movement. It appears to me at least  that there are hordes of developers moving their shops over to javascript (JS).This  I suppose is due to there being better options for organizing the code and how client side code is able to communicate with the server.  You have new JS frameworks that create MVC structure for your web-based projects and along with that you have restful web-services that return Json that seems like a perfect marriage for JS to move and display data. Now we are going so far as to actually program your server in JS and complete the full request cycle without deviating from the JS. You could also embrace technologies that stored your data in JS type objects and  you can kiss SQL traditional data storage goodbye as you embrace this new form of development. I currently work for a Microsoft shop and have worked a little bit in JS. I have seen the brutal nature of scripts that go on for days and have very little structure. I once chased an error for two weeks before realizing that it was an extra comma in a 2000 line JS file that had been left there by accident from a previous cohort. I have rendered large amounts of data using every Jquery plugin under the sun.  But where I have lacked knowledge is good OO methodology for building scalable and maintainable JS projects. So I decided to start from the start and relearn JS from the very foundation. I'm hoping to go over the entry items and with weekly post work my way into a full website example. This is mostly something I promised a couple of friends of mine they wanted to learn how to code. I find to as I put my thoughts out here for the world I try to make them more meaningful and in doing so I feel educated personally by doing this so hey win, win.

So this next section is a rundown of what I personally know about JS off the top of my head. I'm sure I'm going to leave a few things out my apologies. I don't claim to be awesome just another scrub trying to earn a buck for his family who needs new shoes and electronics. So now that the disclaimer is out of the way lets talk techy for a bit.

Javascript(JS) is a interpreted language what does this mean it means that it is ran directly as is and is not compiled before hand into a language the the computer understands. It is supported in all browsers and the engine the interprets and executes JS code has made some major jumps in the last few years which also is probably why it's becoming a more feasible solution.

There are drawbacks for interpreted languages mostly they are slower then compiled languages and the big one is they are not checked for errors during compiling to avoid pitfalls. If you make a mistake in JS it's going to show up for your users so testing becomes key and most of all organization like the instance I mentioned earlier if you mess up your markup you may be on a hunt to find where the issues reside. I've heard that the syntax of JS was influenced by Java but don't be a noob and tell people (especially techy folk) that you are writing Java as I have heard many a person say then to my chagrin find them writing JS. However the good news is now you can tell your peeps you are a Javascript Developer and they think you are the man and shoot lightning bolts from your backside like William Wallace.

Javascript is a un-typed language I have also heard the term loosely type language meaning that you do not have to strongly type your variables before you assign them and also you have the flexibility to use a variable for one type here and then assign a different type down the road and hopefully you can see by this statement alone why this can be troublesome and why not being frivolous with this power is vital to keeping maintainable code.

So that is what I have for now buckle up next week I'll start going over the types and assigning variables. Then onward and upward. Remember to code like Vikings. :D