The Complete Node JS Developer Course

This page is getting a bit too long, so it has been replaced with the new Code Nut Blog! Check it out here.






Hello world!


On Friday 29th January, I mentioned in the blog post 'Time to Celebrate! An Update on my JavaScript Journey' that I'd be starting a Node.js course. Well, today is the day!

I'm trying something new in terms of documenting my journey on this single page, so it's all in one place, instead of lots of separate blog articles. The entries will be in date order, starting with the first entry at the top of the page and working down to the most recent. So, here goes!

The Complete Node JS Developer Course @Udemy


This Udemy course was recommended to me by Kingsley Ijomah. He's an experienced software engineer and a fantastic online coding tutor! He has not yet produced a JavaScript or Node.js course, but he keeps his ear to the ground.

The main instructor for this course is Andrew Mead.

Sections 1 to 3 will be covered on this blog page, and then each Section after that will get its own page on the blog.


Monday 01.02.2016

Section 1

Course Intro


The first three videos are to introduce the course and the instructor, and to get you all set up and ready to take the course. First we downloaded Node.js and the recommended text editor, Sublime Text, which I have been using for about four or five years.

Section 2

Introduction to Terminal


We're going to be using the terminal to run our Node.js files. I had some lessons on the Terminal about a year ago, and it reminds me of using my mum's old computer when I was a kid. I just got used to it because I used it every day to play games on floppy disk... Fast forward a few years, and I have unlearned a lot of stuff! The more you use Terminal, the more instinctual it becomes.

I use a mac, so I followed lesson 4, which is specifically for OS X & Linux. Lesson 5 is for Microsoft.

In this lesson we're learning to navigate our computer using the Terminal. Here are the main prompts we've covered so far:

pwd = print working directory
ls  Lists out all the folders and files inside the current folder
cd = change directory - Allows you to specify a folder name and navigate to that folder

The instructor, Andrew Mead, runs at a really good pace, and it's easy to keep up with the course. So far, so awesome.

Hello World!


In lesson 6 we learn that to run a node file from the Terminal, you must type the following:

node filename.js

So, that's the word node, followed by a space, followed by the .js file name and then press enter.

This lesson was really slow and simple. The task was to create a .js file, write a simple console.log statement containing a string, and run it from the Terminal.

For someone who knows JavaScript already, parts of the course may be a little slow and repetitive, but that's great for people who want to learn or revise JavaScript and Node.js at the same time.

Section 3

What is Node.js?


In lesson 7 we're back to the Terminal again. If you simply type the word node and press enter, you can use the Terminal as your text editor instead of using Sublime.

Section 3 of this course is pretty much teaching you JavaScript.

Node.js is essentially JavaScript, but it can do some things that JavaScript can't. The differences are explained in more detail later on in the course.



Tuesday 02.02.2016

Variables


Lesson 8 is an introduction to variables.

A great thing about this course, and something that would have been extremely useful when I was doing the codecademy JavaScript course, is the brief introduction to error messages. This is vital knowledge for people who want to work in the field of programming.

Jumping ahead slightly, here's a quick insight from lesson 9:

It's common to see variable names that start with a lower case letter. A useful thing to know is that the first character in the name of a variable can also be an upper case letter, an underscore _ or a dollar sign $. The subsequent letters of a variable can be lower or upper case letters, or numbers, i.e. from 0 to 9.

Error Messages


Andrew shows you the right way to create a simple variable, using the var key word, and he explains that var is used to signify a variable, but it cannot be used to name a variable. In order to explain that concept, he gets us to deliberately create a variable with the name var so we can see the error message that it throws up.

This course is getting a big thumbs up from me so far! :)

Strings


In lesson 9 we learn how to identify and create a string.


Usually programmers use a single quotation for strings, because it doesn't require any thinking. You just tap the key on the keyboard and voila! But you could use double quotes if you wanted, but that would require pressing the shift key as well, so it's more to think about.

It's best practice to use the same type of quotation marks consistently throughout your code, so programmers tend to choose the single quotes as it's the most instinctive option.

This is another helpful insight from Andrew as he really gets into the psyche of the newbie.


Wednesday 03.02.2016

Numbers!


This is getting interesting! In lesson 10 we get to grips with using Maths operators.

We also learn a bit more about variables.

There are two ways to create variables, as illustrated below.

You can create a variable and 'initialize' it with a value, or you can create a variable for use later, and not give it a default value. Well I never! This is another great insider tip that will be needed in the field.



Great stuff!

Increment and Decrement

It can be easy to get disorientated when dealing with Mathematical operators. Here's another great insight that will help when incrementing and decrementing.

Example 1


The following will take the value 24 from the age variable and return 24 + 1, which is 25.


Look at line 5 in our example above, and compare it to the example below. That will perform the same calculation of 24 + 1, and achieve the same result of 25. It is, however, a much neater way of doing the same thing.


The following example will take the same value of 24 from the age value, but this time it will return 24 - 1, which is 23.


Again, if you look at the example below, we see the much neater way of doing the same thing.


When you're first confronted with age++ or age--, it can be intimidating, but when explained properly, it's quite simple really :)

Example 2


Another way to simplify things further is as follows:




So there we have it! Our journey into numbers and variables continues at a pace!

If statements


You can never get too much practice where if statements are concerned!

In lesson 11, because we haven't been introduced to arrays yet, there's lots of practice typing sets of data out the long way. But that's great, because you will need to use, ===, !==, && and || in if statements (although not quite so intensively), so it's good to get to grips with what they do.



The course is great because you type along with the instructor as you go along, and then he sets little tasks so you can practice what's just been covered. Programming is such a practical skill so, in the early stages especially, it's a case of use it or lose it. We save each mini project into a file as we progress, so you can look back through the files and see how far you've come.


Thursday 04.02.2016


Lesson 12 is about functions and it is pretty straight forward to follow. The next lesson is about objects, and that's where things get really interesting!

Objects


Lesson 13 explains objects really well! As usual, the instructor gives useful and practical insights that will be needed in the field. For example, Andrew shows us how to log out a whole object so we can see what values and properties are set in that object. That will be invaluable in future when debugging objects.

Bracket notation and dot notation are explained in detail in this lesson. I did not know that you could use bracket notation to create a property and then call the property using dot notation, and vice versa. That's good to know.

The main difference between bracket and dot notation, and the benefits of using bracket notation rather than dot notation in certain circumstances, are also explained.

Bracket notation is useful because you don't have to know the property name in order to access it, whereas with dot notation you do have to know the name.


10% Completed so far!

Friday 05.02.2016




It's the end of the first week, and it's our first project! Each project will be covered in its own dedicated blog post, so you can check out PROJECT 1 here! Enjoy! :)


Saturday 06.02.2016




I've committed all the work we've done so far to GitHub. I think I've finally got to grips with it. I committed a project to GitHub before, but for some reason the little square for that day wasn't shaded. That's because I hadn't added an SSH key to my account. I'm surprised I was able to commit without it in the first place, but it's all done now, and you can check out my account here.


Sunday 07.02.2016

Booleans


Lesson 15 is all about Booleans! The taught part of the lesson was very clear and easy to follow; the independent task, however, was a bit vague, but the instructor did that deliberately. He wants us to get used to doing independent research and solving our own problems, because that will be an everyday part of life as a programmer. The internet has a wealth of forums and documentation that we need to get used to referencing.


Monday 08.02.2016


I have uploaded the boolean task to GitHub. I did the task over two days, and here's the final product:


The task was to create a function that takes a boolean value and flips it. So if the value is false, the function will return true, and vice versa. Because I set the value of the variable isValid to false, the final outcome should be true.

The extra challenge was to create a function that only accepted booleans. That's where the bit of research came in, the fruit of which is on line 5. We hadn't come across typeof booleanVar in the course, so the journey continues to be very interesting and engaging.

As always, the instructor goes through everything and demonstrates a possible solution, so you're never completely stuck. I have modified my solution accordingly, because initially it was very lengthy, but now it's a little more elegant.


Tuesday 09.02.2016

Undefined


Lesson 16 is all about undefined. The independent task follows on from the previous lessons, and includes functions and if statements. Typeof also makes a reappearance.

This time we had to create a function that returns one thing if we give it an argument, or another thing if we don't give it anything. See the code below. It is also on Github.


In the first instance, on line 16, we have given the fuction a name, Andrew, so it will return 'hello Andrew'. In the second case, on line 17, we have left the brackets empty, so it will return 'hello world'.


Wednesday 10.02.2016


I had a break from programming this evening but I'll be back tomorrow!


Thursday 11.02.2016

Arrays


Lesson 17 covers some really interesting stuff!

Methods


A method is nothing more than a function; it's just accessed using dot notation.

.push method


You can add an item to the end of an array using the .push method!


.unshift method


Here, we have an array containing the numbers 100 and 50. But by using the .push method, we have added the number 79 to the end of the array. So when we run it from the Terminal, it will return all three numbers: 100, 50, 79.

You can add an item to the beginning of an array by using the .unshift method.


.pop method


You can also remove items from an array. The .pop method removes the last item of the array. So when you run the program, that last item will no longer be returned, but the next item along will be returned instead.


In this case, the .pop method on line 3 will remove 79 from the end of the array. Line 5 will show us which item has been removed; i.e. 79 will be logged out by line 5. By the time we get to line 6 and log out the full array, the number 79 will be nowhere to be seen! .pop magic!


Friday 12.02.2016


Continuing from where we left off yesterday with arrays:

.shift method


As we saw yesterday, the .pop method removes things from the end of an array. The .shift method, on the other hand, removes the first item of an array.


In the example above, 100 will be removed by line 3, logged out by line 5, and nowhere to be seen when line 6 logs out the full array.

Iteration: the forEach method


This method is special because it takes a function as an argument.


Functions


In JavaScript, naming a function is not required. It's only required if you're going to be referencing the function at any given point. If you're simply passing in the function as an argument, there's no need to name it.

.length method


In this example, the .length method will log out the length of the array, which is 3, because there are 3 items in the array.


The Challenge


We had to create a program that added the grades together (i.e. 100 + 50 + 79), divided that total by the number of grades (i.e. 229 / 3) and returned the result (i.e. 76.333...). It looked a little something like this:


Saturday 13.02.2016


Valentine's weekend... No coding for me :)


Monday 15.02.2016


In lesson 18, we build on Project 1 - the bank account project - by creating a couple of new functions. This lesson just outlines the tasks to be completed, so you work on them independently before moving onto the next lesson, which contains possible solutions. I'm going to work on that now, so depending on when I finish the project, I will be posting the update then.


Friday 19.02.2016


Project 2 brings together a lot of the things we've been learning in previous lessons. Since Monday, I've been working on little bits of code every evening after my work commitments and rowing training. I think I'm actually getting a better understanding of what I'm doing and why I'm doing it because I'm taking things slow instead of steaming ahead. I've also asked Kingsley to look over things to make sure I'm on the right track. Check out my code on GitHub or below:


Now that I've done my bit, I'll be moving on to lesson 19 to see how the instructor has tackled the task. I'll cover his solution in a separate blog post, which is available here now! :)


Monday 23 February 2016


Back after a busy weekend! I've just completed lesson 19, in which the tutor provided the solution to the Project 2.

Useful Note: When a function is a property it's called a method. But a method and a function are pretty mush exactly the same thing anyway. So you can use the terms interchangeably.

I have uploaded the worked solution to GitHub, but you can also check it out below:



It's in two parts because the document was too long for me to copy it out all in one go, so I had to do two screen-grabs.

I've written up a full article so you can follow the solution more clearly here.


Saturday 27.02.2016


When I started this blog, it was my intention to do one lesson every day and blog about it every day. I've fallen behind since Valentine's weekend because of competing priorities, so rather than run the risk of running out of steam completely by sticking to a goal that has become unrealistic, I'm going to adjust my commitment. I'll be posting weekly updates from now on, so please check back soon! :)


Wednesday 02.03.2016


Hello good people! I am definitely getting back into the swing of things!

Project 2 - Bank Account v2 is on the main blog! It's been broken down into easy to follow steps, and everything has been explained. Great for beginners! Check it out here! :) Enjoy!


Friday 04.03.2016


I have completed 14% of the course! Yay!

for and while loops


Lesson 19 started off with a simple demonstration. We followed along and created the simple countdown program below.




Once that was done, we had to go away and tackle a little project of our own. This time, we had to create a couple of countdown functions, that both do the same thing, but one uses a while loop, and the other uses a for loop. Here's mine below:


After that, I resumed the video and followed the tutor's worked example. See below:


 I've got loads of notes on for and while loops from the codecademy course that I did a few months ago, so I'll write a full blog on that soon.


Sunday 13.03.2016


It's a beautiful sunny day and I am feeling inspired!

Lesson 20 is all about Scope.

Scope - Global Variables and Local Variables


Global Variables are defined outside any functions, and they are accessible from anywhere inside the program.

Example 1: Global Variables




NOTE: We didn't use the 'var' keyword within the function, because the global variable, 'age', has already been defined on line 1.

What we are doing within the function is simply modifying the value of the existing 'age' global variable. We are changing it from '24' to '0'.

'0' will be logged to the Terminal.

See the next example to see what would happen if we did use the 'var' keyword inside the function as well.

Example 2: Local Variables




Here we're not modifying the existing 'age' global variable, we're actually creating a new local variable, also called 'age', within the function.

This will log '24' to the Terminal because we are referencing the local variable within the function.

So, there you have it. A brief introduction to Global and Local Variables.

Just 3 more lessons left in Section 3, and then it's on to Section 4: Getting Input & Storing Data. We'll start that section with a fresh new page on the blog. Keep an eye out for it!

More coming soon :)

https://github.com/DanielleIjomah


No comments:

Post a Comment