3 ms·
If you want the newbie to learn something immediately useful and with the potential for deep understanding of some programming concepts, there's one clear choic
by WildUtah 15y ago
If you want the newbie to learn something immediately useful and with the potential for deep understanding of some programming concepts, there's one clear choice. Unfortunately, that choice is JavaScript.
JavaScript is the language the modern web is written in and it's a language you can use to build and automate cool stuff that you can show immediately to your friends. You can build interactive programs, save state (in cookies), deal with formatting and input, and even do graphics with CSS or canvas. jQuery or its competitors will cover up most of the warts.
It's not a brain dead verbose bondage experience like Java nor deep in the metal like assembler. It isn't historic and systems oriented like C or mathy and abstract like Scheme or LISP. It can take advantage of much of the semantics of those languages as you learn it if you need them.
The tools to write and run it are simple and some good debuggers are built into your browser. Everyone owns a few client interpreters with a great application environment.
It's not pretty (boy is it ever not pretty) but JavaScript is the best language to start with.
If I couldn't choose JavaScript, I'd point my friends at Python or Ruby. They're better languages for both beginners and experts but they're not JavaScript.
- tikhonj 15y agoI agree wholeheartedly. I started out with JavaScript, and it was a brilliant language to learn. I was doing cool stuff--websites with content and pictures and color--almost immediately; with other languages like Python or even Scheme, I would probably still have been writing dry command-line programs. There's a place for command-line programs, but it isn't at the very beginning. JavaScript is great not only because it lets you start with concrete stuff immediately, but it's stuff you're already familiar with: everybody uses the internet now. I also found the basics of HTML much easier than any other UI framework I have ever used (Swing, WPF and TK mostly). All of this is coupled with the fact that, ultimately, JavaScript is a really nice, really expressive language, also makes it my choice for a first language. However, if not for JavaScript, I probably wouldn't point people towards Python/Ruby so much as Logo, which has many of the advantages of JavaScript and is well regarded by CS educators.
- orthecreedence 15y agoI agree on a few points and also disagree on some. I agree that javascript is very easy to get started with. The syntax is similar enough with other languages (C, Java) such that you could just into one of them easily after a bit of experience with javascript. It's also very easy, as you said, to actually DO something with it. You don't have to import 500 libraries to draw a line on the screen or make highly interactive (or even beautiful) interfaces. Javascript is also somewhat close to lisp in its functionality. That being said, I feel as though learning javascript first is putting the carriage before the horse. If someone is learning to program, I believe it's best they start off learning the basics. The idea is to learn the concepts behind mathematical thought...to learn the rules, and then learn to break them. I think someone who learned javascript first would know how to do things great in javascript, but not necessarily any other languages. They would know how to program interactions, but not necessarily how to program in general. Another thing to keep in mind is that javascript is highly concurrent. You almost can't do anything in it without dealing with layers of events interacting with each other. This could be confusing and detrimental to someone who's just beginning to learn. I'd argue it's best to start with C/assembly for a low-level view of how computer work, and then afterwards lisp and perhaps javascript for higher mathematical programming.
- xyzzyz 15y agoand abstract like Scheme or LISP. Why do you think that Common Lisp (LISP) is abstract?
- sedachv 15y agoJavaScript would definitely be my #2 choice to recommend to someone who wants to program. One of the problems with JS used to be that there weren't any even half-decent "Learn to program with JavaScript" books until Marijn Haverbeke's (who also happens to be a prolific Lisp hacker) Eloquent JavaScript (http://eloquentjavascript.net/ http://eloquentjavascript.net/) came out. It's a very solid introductory book. HTML5 Canvas is also awesome - IMO it's the most convenient way for beginners to do computer graphics in any "real world" programming environment/language.