Node and NPM

Session 2015-01-05

Summary points:

We had a great session were we started talking about how to focus our sessions and we let clear
that can be very useful if we start with the doubts or questions that I have from what I’ve been studying, so
I’ll keep it in mind and we’ll come over the doubts I have.

We focused our conversation in NodeJS, started talking about were the NodeJS comes from
and the difference between synchronous and javascript asynchronous.

Synchronous is when we have to wait until one task is completed and we got the result back to continue with the next one.
Asynchronousis when once we have started one task, we can start the next one without the need of waiting for the previous one to be completed.

We commented why Ryan Dahl choose V8 from Google over other JS engines, and it was because Google is a powerful company with a lot of interest in
JS since they got Gmail, Google Maps and so many other tools running in JS.

Actually JS is getting high efficiency performance and is actually close two times slower than C for a quick comparison, php is 10 times slower than C
and Ruby is 20 times slower than C.

We checked that I have the latest (or one of the latest) versions of node installed node -v we also checked latest versions of npm npm -v.

Created a new folder to do some testing and created a new file called index.js with the content

console.log('hello world');

So at terminal we typed node index.js and the js code at the file was executed showing us the result. *Wow! we can execute at terminal the code without need of the browser to check if it works as expected, great!`.

Then we came to use the npm site and installed the colors package with the command npm install colors (now we have in this project the plugin colors installed).

then we modified the index.js file and added the following lines:

var colors = require('colors');
console.log('hello world'.cyan);
console.log('hello'.cyan, 'world'.magenta);

After running the command node index.js we saw the following result:

2874699936-Screenshot 2015-01-06 12.28.24

After checking how awesome the terminal can be, AirCrewMentor remarked how important is to test your code and how publish
this information when sending some code can really make a difference in the quality of your work and public profile.

I need to learn how to test the software and how to see if the software I am using from npm or other sources is valid or not.
It is not the same if we are using some code we got from a source where the file explains really detailed all what I can do with
this code and show the testing and the result of the testing, or how I can run the test for the software.

The documentation for the projects is really important because when I am going to use a new code, I need to be productive asap and
not loose the time reading the code and figuring out what I am able to do with it.

Well documented & tested code is a must when coding.

Next Session Objective

  • Start testing with the console the code
  • test and document the code cuanto cuesta
  • Publish it on GitHub.

Thanks Mentor, as I told you yesterday, you are keeping me really excited and motivated to keep learning. Looking forward to the next session.



Mentorship Session

Great 1:1 we had, I enjoyed it a lot. So now that I have it fresh, I am going to introduce a little summary, feel free to correct me if I don’t have something right. 🙂

We started talking about the history of JavaScript, since it is good to know where it all comes from, so we can have a better judgement in our future decisions and better understanding of the actual scenario.

JavaScript was born a long time ago in 1995 as a technology for Netscape, originally developed by Brendan Eich who results to be co-founder of Mozilla project.
The development of JavaScript had the purpose to be a complement of Java as an independent language for non professional programmers. (like Visual Basic for C)
Microsoft added support for JavaScript on internet explorer on august of 1996 and Netscape in November of the same year 1996 submitted it for standarization to Ecma International.

So the language was born, but the programmers didn’t wanted to code with JavaScript because its target audience consisted of web authors and other such “amateurs”, among other reasons.

But then Google changed everything in 2004 with Gmail and AJAX. It focused the attention on the language, because of the wonderful features that could be done with it, despite gmail was coded in Java and then ported to JavaScript.

In 2004 Jeff Atwood founded a very popular blog called Code Horror where he related the bad practices he found on the JavaScript world.

The browsers were really difficult to interact with, since Microsoft with the Internet Explorer weren’t following the standards and the web developers couldn’t see how everything was being processed, so it was quite a difficult time for web developers. So in 2004 Firefox was released to public, but until 2006 wasn’t launched the add-on Firebug that changed the way the developers could interact with the browsers and the code they were working on.

In 2006 Yahoo who was had the site developed in JavaScript launched the YUI Library that helped a lot of developers. The same year 2006 was launched JQuery that became very popular, even more popular than the JavaScript language, in fact, the job offers where posted searching for JQuey software developer, not JavaScript.

So at the time Douglas Crockford by 2002 launched JSON website who saw the potential on the JavaScript language. So he wrote in 2008 the book JavaScript: The good parts where he focused on the good parts of the language, and it helped a lot of programmers to see the true potential of JavaScript.

In 2009 was born Node.js in a search of an asynchronous way to interact with a website. Node.js was developed for JavaScript because of the lack of an existing I/O API, so they could start from scratch and define a convention of asynchronous, event-driven I/O. Node runs with the V8 developed by Google for Chrome.

I hope I got everything (or at least the big part) we talked about. Please feel free to make any comments or corrections.

Thanks! 🙂

Mentorship Session

Here is the proposal:

Lets have a 2h hangout once you’re done with Eloquent JS in order to discuss the best way for you to move forward.

There are some basics you still need like:

  • Debugging techniques
  • Node.js (npm, semver, CommonJS..)
  • HTML5 (CSS3, sass)
  • Source Control (git)
  • Server side development
  • Testing (unit and functional)
  • Deployment of projects.
  • Finding, reading and contributing to FOOS

I will create a ticket for each one of the entries with recommended learning resources, but it might make sense for you to start working on a real project where you can start practicing all those skills.