3 ms·
It's funny to come across this just now...for the past quarter, I've been teaching a basic programming class that focuses on the command-line...the most complic
by danso 12y ago
It's funny to come across this just now...for the past quarter, I've been teaching a basic programming class that focuses on the command-line...the most complicated thing we cover is sed (here's a list of tools we use: http://www.compciv.org/unix-tools/ http://www.compciv.org/unix-tools/) and the homework I've assigned generally involves scraping and data-munging, such as writing a batch job to scrape the USAJobs.gov API (http://www.compciv.org/curriculum/ http://www.compciv.org/curriculum/)...
I agree with the OP that conceptually, the command-line is the best place to start learning programming...the idea that a tool should be kept simple, but that it should be easy to connect things together, and that it's up to the human operator, not the computer, to do this work...this is very powerful, and something I wish I had learned early on as a programmer. The way that Unix tries to think of everything as text is also a powerful concept, because for most beginners, they think of file formats as being "magical" and immutable, they don't have the concept that at the core of it, everything is just binary (everything being "just text" is a nice middelground from OS magic and trying to read binary)
However, the beauty of this philosophy is hard for non-programmers to appreciate or take advantage of. Moreover, things that I love as a programmer, such as silence-by-default and sparse error messages...are massive stumbling blocks for beginners. While I've done enough programming to appreciate silence, it's another thing to be a beginner who has never edited code in a text-editor to deal with "silence"...perhaps the biggest obstacle is the high difficulty in debugging. I can generally pinpoint any error in seconds...but this is only after years of general programming. The way that Bash continues on when an undeclared variable is referenced (via a typo) has led to hours of frustration for my students.
I think next year when I teach the class, if I do Unix again, I'm going to commit the first two weeks to muscle memory and flashcard-like memorization...it's too difficult to get the higher-level concepts of programming while you're stumbling around with recognizing variables. On the other hand, I think I may not try to teach Unix again, and will just stick to Python. One of my goals of teaching Unix was to avoid complexity and especially, things like OOP...I think Python can be carefully taught to fit that route...though I'll miss the ability in Bash to do such real-world tasks as curl, parse, and analyze a webpage in just two lines.
Edit: There was also a practical reason for doing things in Unix...all my students have different kind of laptops and OSes...and Stanford's shared computing runs on Ubuntu. So they did all their assignments on the shared computing cluster. That led to another issue of not being able to easily edit script files, in the way that you can do with Sublime Text on your own OS.