All right welcome back.
So as I promised in the last video we're now done with just pure command line basics.
We're going to continue to use all of the commands we talked about in pretty much every video.
But they're not going to be the focus of the videos going forward.
They're just now another tool for us to use as we learn new technologies the new technology that we're
going to learn about.
And this video is no.
Yes.
And before we get there I'm just going to make a new directory to put some files in.
So I'm going to make directory intro to node just like that and then CD into intro to node just for
more practice and I'll add a file objectives dot empty and this file won't actually do anything all
that will use it for is a place for me to put some objectives so that we can guide what we're going
to talk about in this lecture.
So this is intro to node and there are just two main points I want to talk about.
The first one is what is node.
The second one is Why are we learning it.
And then the very last point is it doesn't matter.
So I'll come back to that at the end.
So let's begin and talk about what node is.
So you might have heard of node before and that's because right now it's the trendiest hottest thing
in web development for whatever that's worth.
We're going to talk more about why we're actually learning it.
I assure you that it's not just because it's trendy but that is one reason that you may have heard of
it before it's all over the place on blogs and books and all sorts of conferences node is all the rage
.
So what is node.
I have the official know O.J.'s home page here.
Node JS. dot org.
And according to this page no J S is a javascript runtime built on Chromes V8 javascript engine no JSE
uses an event driven non-blocking IO model that makes it lightweight and efficient no JSF package ecosystem
NPM is the largest ecosystem of open source libraries in the world.
So let me try and explain it in a simpler easier to understand way.
Up until a few years ago all the javascript that you wrote had to run in the browser.
It was the only place for you to execute javascript code and that meant that all javascript that you
wrote was only front end code.
You couldn't do anything server side because the only place that it could run is the browser.
So that's what we've been doing up until this point.
Writing our javascript in js files linking them through a script tag to an Tim L file an opening that
in the browser but that all changed a few years ago when no genius came along.
So all that note is is a way for us to write javascript code on the server side.
So remember this diagram from the intro to back end lecture where I showed a generic stack where this
line right here denotes the boundary between the back and or server side and the front end or client
side before node came along.
All the javascript we wrote was happening up here on the front it just like all of the JavaScript we've
written so far.
And then on the back end there were languages like Python or DHP or Ruby or Java but javascript was
not an option.
But no it changed all of that.
Now we can write javascript code right here on the server side interact with our database to start a
server to create new files and all sorts of server side logic and we can write javascript on the front
end.
So what that means is that we can now write javascript everywhere.
Sort of wrap that up.
I don't want you to get too hung up on the terminology of a javascript runtime built on Chromes V8 javascript
engine.
All that you need to take away for now is that node is how we run javascript on the server side.
So that was the first point.
What is node the next and probably more important point is why are we even learning it.
So as I mentioned earlier node is definitely the hippest the trendiest it technology for people to be
learning right now.
But I'll say this right now that is the smallest reason why we're learning it so it's not something
that we can ignore.
But it is definitely the least important of the reasons that I'm going to mention.
So add that here.
It's popular.
We can't deny that.
I'll show you some stats and charts that reveal some interesting trends about how Noad compares to other
similar technologies in the last few years.
So what does it mean for a technology to be popular.
The first thing that I'll mention is that node is definitely popular amongst existing developers.
Almost everyone that I know who is an engineer or a senior engineer has picked up node on the side as
something that they're interested in something that they want to learn about.
They'll build side projects and act together things late at night which is always a great sign when
there's a lot of excitement and buzz about our technology.
But again I don't think that's a great motivation for you a beginner to learn.
Note what this chart shows is just the rank of the ten most popular languages on get hub.
Over the last seven years and you can see that in 2012 javascript overtook Ruby as the most popular
language on all of get help.
The last two pages I want to highlight I think are the most important here.
They're from that web site stack share that I demonstrated earlier the last two pages I want to show
are from that website Stex share that I introduced in the intro to back in video.
And I have a search open for DHP which will pull into its own window and I have one for no yes as well
and I want to just take a look at these key terms.
Why people like HP and why people like No J us and there are good reasons on both sides.
I don't want you to get the impression that I'm trashing peech or anything but I just do want to show
a contrast in some of the reasons people like them so APHC some of the more popular reasons are large
community which is definitely an important aspect.
We also have that over here great community for Node 2.
I want to highlight though our good old Web and Web Foundation as well as the best glue on the web.
These are different ways of saying that ph V has been around for a long time and it's sort of the grandfather
of web development if you will.
Now let's take a closer look at some of the reasons people like Noad and some of the ones all highlight
are great libraries which is really important and we're going to use some of those libraries.
Javascript's that's the most voted or second most voted one and that's really really important.
It's in javascript.
People love javascript.
We'll be able to write javascript on the server side.
We don't have to learn another language.
The other aspect is high performance and that's one of the reasons it's getting so much attention from
companies and startups all over the world.
What makes something higher performing or more performance is for another lecture entirely.
But the fact that so many people have mentioned they like it for being high performance is a great indicator
of the fact that it's high performance.
So I spent the last few minutes trying to prove to you that note is popular it's trendy there's new
jobs in it and it's only getting more and more popular.
But I did start out by saying that that's not a reason really why we should be learning it.
It's the smallest reason but the most important reason that we're learning it is that it's in javascript
and that's important because we already know javascript.
So we don't have to start from square one pick up another language.
Learn how variables work in THP or in Ruby or in Python and how loops work and how arrays work and objects
and oh wait some of these languages don't have objects and things just change so much.
It can be very confusing for someone who's just starting out.
Do you have to switch gears.
One hundred percent and abandon javascript for you know the next half of the course until we bring it
back at the end rather than doing that by using node.
We're able to write javascript on the server side with the same exact syntax that we know and love.
And I've been working with for the last half of this course.
One of the phrases I would repeat to my students all the time is that you guys are not here to learn
technologies you're not here to learn languages.
You're here to learn web development and web development changes so fast you might go from a job where
you're writing Ruby and using rails and then a year later you go somewhere else and you're asked to
learn node and you're writing express or sales.
Yes.
And then a year later you're picking a python and flask and things can change all the time.
So to summarize I'd say that it does matter in the short term.
It is something that I mean I thought about this for a very long time.
You know I'm fortunate I've taught things in C and in Java in Noad and Javascript in Ruby and Rails
and Python.
So it wasn't a matter of what I was comfortable teaching.
I was able to pick what I felt would be best delivered through this video course.
What would be the best first server side language for someone who has never done any server side programming
and who is just starting out by using a video course.
And I ended up setting a node.
So it does matter in the short term but if you do continue with this it really doesn't matter.
So I'll append this.
It doesn't matter.
Long term and that's true it really doesn't.
This is just your first introduction.
So it seemed significant.
And it was certainly an important and significant choice for me to make and I thought a lot about it
but for you once you learn node once you learn server side programming it won't be difficult to transition
to something like Ruby or to Python.
Hopefully this video got you at least a little bit excited about learning node and about making web
apps.
Because in the next video we're going to see our first taste of writing code using node