Object Oriented Programming, Babel and FileSystem.


  1. Object Oriented Programing.
  2. Ways of creating an object (9?)
  3. Use of ES6 – Babel.
  4. Generate Data.


We had a more relaxed (but no less intense) session, we started talking about history and where the the Object Oriented programming comes from.

1. Object Oriented Programing.

So in 1985 Steve Jobs founded Next and started talking about the wonderful features of this kind of object Oriented programming.

Here we can see him explaining it. https://www.youtube.com/watch?v=2kjtQnPqq2U

2. Ways of creating an object (9?)

This is a question that is often asked on interviews so I am going to list them all here (at least what I know or can find):

(to be continued)

3. Use of ES6 – Babel.

It is time to start learning to use JS6/ES6 (ExpressionStatement) so when it comes available I can have a good set of skills, for that we can use Babel.io, I am not sure how I am going to do it, since I really don’t know that well JS5.

I hope @AirCrewMentor can give me some more guidance or stablish the path to start using it.

ES6 Features

4. Generate Data.

Here comes the main subject of the session, how to start creating files from our data with node features.

So it is common convention to have a /bin folder where we can locate our binaries.

So we included a file with a sentence that is known as a shebang

#!/usr/bin/env node

With this we are passing the code that follows into node for its execution.

So we created a file without extension and added the code so it runs inside node:

#!/usr/bin/env node
var Papa = require('babyparse'),
    fs = require('fs');

function getAirports(callback) {
  var airportsCsv = (__dirname + "/../files/airports.dat");
  fs.readFile(airportsCsv, function (err, data) {
    if (err) {
      return callback(err);
    Papa.parse(data.toString(), {
      complete: function(airports) {
        callback(null, airports);

  if (err) {
    throw err;

With this code we are using the FileSystem module from Node.

When we were going to execute the file on terminal typing just $ ./bin/generate_icao we find a problem, it wasn’t executing and it wasn’t automatically selected when tab was pressed.

This is because we didn’t have execution permissions, so we changed chmod +x filename.extension


I have to lint properly all the code. Using JSLint is a must.


  • Get file Writing (I have to enable the automatically creation of files)
  • Use Async with limits for operations.
  • Read Callbacks
  • The art of Node
  • NodeSchool.io
Thanks @AirCrewMentor , I’ll hope next time I’ll be more agile, sometimes it is difficult. 🙂

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s