OdeToCode IC Logo

Node.js as a Tool For Learning To Program

Monday, April 22, 2013

If you want to teach someone the very basics of computer programming, then JavaScript might be a good place to start.

- The syntax is flexible and uses only a handful of keywords, plus functions and objects.

- The language includes standard control flow structures (if/else, while, do, switch, throw).

- A beginning programmer would also have an easier time understanding a number of other popular languages, including Java, C#, and C++.

- JavaScript runtimes are ubiquitous.

- Knowing how to program in JavaScript is marketable skill.

Once you've settled on JavaScript as a starting language, then the next question is what tools and environment to use. Node.js might be a good place to start.



- Node is free and easy to install on all the popular desktop operating systems.

- As a pure JavaScript execution engine, you can start by explaining Javascript without explaining HTML DOM APIs.

- Node has a REPL for interactive programming

- Node has a large universe of packages to build anything from a web server to desktop applications.

- Node projects follow simple file system conventions.

- You can still pick any editor or IDE to work with the JavaScript language. 

Using node and JavaScript to learn programming fundamentals is something I'm putting together for a future Pluralsight video, and it's working quite well.

Gravatar Elijah Manor Monday, April 22, 2013
Yeah, that would be my suggestion as well. In addition they can use these concepts to interact with HTML/CSS to make something that could render on most any device with a browser.
Gravatar Prasad Honrao Monday, April 22, 2013
Completely agree with JavaScript language as a starting point. Looking forward for your course on Pluralsight.
Gravatar Mario Monday, April 22, 2013
I agree that JavaScript as a first language can be easy; but while teaching web development, to non programmers, I notice that when we use node they had trouble to understand what code runs on the server and what on the client (browser). Because all are *.js files in the same machine. When we use a different language for the server code, that separation of what runs where is clear.
Gravatar Eber I Monday, April 22, 2013
I wholeheartedly disagree, javascript is a very hard language to master, even for programmers, it has several corner cases and inconsistencies Here some examples http://www.codeproject.com/Articles/182416/A-Collection-of-JavaScript-Gotchas
Gravatar slicklash Monday, April 22, 2013
JavaScript would be the last language I would recommend anyone willing to learn programming as a starting point. The process of learning should be fun and rewarding! For this reason, Python and Ruby are much better candidates.
Gravatar Bob Monday, April 22, 2013
I agree that JS is a good language to learn to program, but node.js takes away a lot of the advantages you posted. JS runtimes are ubiquitous because browsers are ubiquitous. If you're gonna teach a beginner, it's almost certain that the beginner has some experience with a web browser. You can also start with Chrome. If you don't want to dive into the DOM, you can stick with the Chrome developer console to execute JS code. This also seamlessly migrates to DOM lessons. If you don't want to go with Chrome, there are online JS consoles to use. Also, to make knowledge of JS a marketable skill, at least in today's environment, you will have to teach the DOM. Pure node jobs are not as numerous as JS jobs that require DOM knowledge. @Eber I, that small collection of gotchas doesn't make it very hard to master. It's just a few extra things about JS to learn. What makes JS harder to learn is the DOM API, which on top of being confusing is very inconsistent across browsers. In fact, the DOM API is the reasons why libraries like jQuery were created.
Gravatar pthire Tuesday, April 23, 2013
I did the same analysis, and I have started to teach programming with node (I am teacher in a french computer science school). I wrote a little c++ module ("kbd", available on node.org repository) which provides various utilities for keyboard. I wanted to have a node equivalent for puts/gets for my students to whom I teach programming with node. Because starting with asynchrone concept is not so simple ! kdb module provides keyboard input in both synchrone and asynchrone mode. kdb also gives the opportunity to set/unset echo, set unset canonical mode. Thereby, my students are able to write classical little begining program as they would do in C langage. The year is not over, but the experience already seems positive!
Gravatar Scott Allen Tuesday, April 23, 2013
@pthire - this is a great tool! thanks!
Gravatar Doeke Tuesday, April 23, 2013
I think javascript is an OK language. What do you think of the programming excercises of Kahn Academy (https://www.khanacademy.org/cs/tutorials/programming-basics). Seems that lowers the boundaries of not only the setup of your environment, but it also provides feedback at edit time.
Comments are closed.