On Mon, 19 Dec 2011, Sean Dague wrote:
First off, you need to get it out of your head that Javascript has anything
to do with Java. :) I think my favorite quote there is: Java is to
Javascript, as Car is to Carpet.
That's a great way to put it. :-) Yes, they are two different things.
I've recently been tutoring two kids in beginning programming. One of
them wants to do app development for iOS, but I don't think jumping into
Objective-C is the best way to get started. (My first language was BASIC
on a real teletype, and I don't think that would work too well either
these days.)
So I decided that JavaScript would be a good place for a complete beginner
to start, for several reasons:
1. Everybody has it, because everybody has a browser. It doesn't
matter if you have Windows, Mac or Linux, or use Firefox or IE
or Chrome. They all have JavaScript.
2. No fancy IDE needed, just a text editor. Though you do have to
use one that will let you edit raw HTML and .js files instead of
acting as a word processor. On windows you want Notepad not
Wordpad. On Mac Textedit won't work but the Dashcode editor
will. I like emacs, and you can get it for all three platforms
(eg. Aquamacs for Mac), and if you learn emacs on one then you
can then use it on any platform.
3. Short, visual cycle for adding changes or correcting errors.
You always make mistakes, and you learn from correcting them,
and then getting it to work, and then adding something new.
With JavaScript you can make your changes and refresh the
browser and you see the results. For other languages that cycle
is generally all text based and less visually interesting. This
is important for keeping kids' interest, but maybe good for adults
too.
4. You have to learn some HTML and maybe some CSS, but that's not a
bad thing and you can use it for other stuff. But it does add
some complexity -- you are not just learning the pure programming
language. Oh well, now you also know how to make web pages.
5. You can easily share the results with others (in my case mom &
dad) by turning on the web server. On a Mac you just turn on
"Web Sharing" and put the files in a specific folder. Setting
up apache on Linux is a little more work, but someone only does
it once. Supposedly it's not that hard on Windows either, but I
have not been through it. For the kids I tutor the web server
is only on the home LAN for the family to see, it doesn't leak
out to the outside world (we could adjust the router to do that
someday, but so far we've not got to that).
6. The language is a good way to get started with important
programming concepts, such as flow control and data structures,
and also the Object Oriented stuff, but OO is not required.
I don't think JavaScript is anything special as far as languages go,
but it does seem to be a good choice for the task at hand: teaching
complete beginners some of the basics of programming in a way that
they can quickly do something "useful" or at least interesting.
Maybe somene else has other suggestions for this?
There are lots of books on JavaScript. The one I've favored is
"JavaScript in 24 hours" from SAMS. Each chapter is a lesson that is
supposed to take about an hour to read and perform the exercises. A
key observation is that those 24 hours need not be contiguous. If you
did one a day and took Sundays off you'd go through the book in about a
month. They are short, so you could easily do more than one a day if you
have the interest. With the kids, we are lucky to do one a week, but
I'm also doing other things with them.
I also second the suggestion already made that you always type in the
examples yourself and don't use cut-n-paste. And I strongly advise that
you actually do the examples, not just read the book passively. In fact,
you should not only do the examples, but then for each one you should make
your own personal modification (you decide what) to "make it your own".
As I said, I'm doing this with kids, but maybe it's a good approach for
an adult who wants to start programming from scratch too. You tell me.
-Eric
_______________________________________________
Mid-Hudson Valley Linux Users Group http://mhvlug.org
http://mhvlug.org/cgi-bin/mailman/listinfo/mhvlug
Upcoming Meetings (6pm - 8pm) MHVLS Auditorium
Jan 4 - Getting Involved in Open Source
Feb 1 - Home Networking Made Simple with Amahi Home Server
Jan 4 - Getting Involved in Open Source
Feb 1 - Home Networking Made Simple with Amahi Home Server
Jan 4 - Getting Involved in Open Source
Feb 1 - Home Networking Made Simple with Amahi Home Server