So last Friday, he stopped by my house, and we got started. I think since this is sort of a craftsy kind of topic, I'd like to get his hands dirty with some real programming. My language of choice, BASIC. In particular, I used ChipmunkBASIC (because it was the first one I could find). Let me explain why.
1. Simplicity. BASIC has zero complexity. What is the shortest program you can write in Java?
class ShortestProgramClass {How about in BASIC?public static void main(String args[]) {}
}
For me, one of the most demoralizing thing about learning anything is to see all these nonsensical words flying around being used, and then told to wait to learn what they mean. To me, learning is a natural progression from the fundamentals of computer science, to the more complicated stuff. No language starts you off in a better place than BASIC (sorry Ruby users, but everything in Ruby returns a value is a concept I'd like to not cover early on).
END
2. Write programs immediately. I wrote the following lines of code, line by line.
PRINT "What is your name?"After each line, I ran the program. In basic, there is a direct correlation between each line of code, and each action. There's a little bit of glue explanation to connect the concept of variables being containers for values and such, but that's it. Five minutes later, and I'm already giving him a programming assignment.
INPUT name$
PRINT "Hello, " + name$
END
I told him, I wanted to write a simple robot that tried to find out more about you and to give you advice. Sort of like a stunted hunch.com. He came up with the following.
The assignment was organic and natural. Okay, I know how to give instructions, and I know how to get answers. But how do I make a decision? So I taught him the minimalist IF. As the night progressed, I showed him that sometimes, you needed to do more within an IF block, and slowly fleshed out the IF construct. This took a total of 30 minutes of explanation, and coaching on a bit of the mental processes behind how you can think of what a computer interprets.
...
PRINT "How many drinks have you had?"
INPUT number_of_drinks
IF number_of_drinks == 0 THEN PRINT "Go ahead and drive!"
IF number_of_drinks == 1 THEN PRINT "Be careful out there!"
...
3. Algorithms, not Semantics. Algorithms should be the focus of any treatment of computer science. In BASIC, algorithms are King, and it shows since the algorithm itself just pops out.
Computer science appeals to that part of us that likes to solve problems. Technology changes at a blinding pace, so teaching the hot new language of the day is not the way to go. Believe me, companies would rather have the guy that knows how to solve the problems, than to have the guy (several years ago) who's a master at Python but nothing else. Programming languages are fickle. Algorithms are not. My session with my friend reaffirmed this belief. With less than an hour of teaching him and keeping him engaged, I could already see that he was struggling to change his view of how to solve problems to fit in the basic model of how computers think. It was a joy to witness. If anyone hasn't tried tutoring someone, I highly recommend it!
4. Easy To Be Thought-Provoking. I'm sorry if I appear to be repeating myself, but all the teaching becomes easy because BASIC is such a simple language. I think it's just the right combination of power and ease of deciphering to teach a completely new student. For instance, basic hides enough of the complexity to make programming easy, but is still constrained by basic 32-bit variables. This seems like an oversight, but I think of it as a perfect way to end a lesson with something thought provoking. This part took a little longer because I had to teach my friend the basics of binary, or mathematics in any base, and some of the tricks we use to represent numbers. Now, I didn't go into specifics here, but I did more or less introduce a simplified account of mappings and set theory to introduce how we map a bunch of binary numbers to negative numbers and such (I highly recommend not even mentioning floating point numbers).
Once I finished this, I showed him a BASIC example that gives an unexpected result. This was heavily inspired by the documented problem with MergeSort, as it applies to larger problem sets that use 32-bit built-in arrays.
...This yields a large negative number. And asked him if he could explain why this happened. After a bit of thinking, and a bit of guidance, I saw his eyes light up as he began to grasp the problems of wrap-around associated with essentially a clock arithmetic system. It was amazing to see him gradually integrate these complex notions.
PRINT (35000 + 35000) / 2
...
In any case, I decided to end the lesson at that point since I felt that I had already overloaded his brain. The best part of the exercise was that he wanted to keep working on the little assignment that I gave him!
So why aren't we teaching BASIC in college more? It's hard for me to comprehend. Is it because it technically has no vocational use outside of an educational setting? Well, that's not true. After all, Microsoft's Visual Basic is based off of BASIC (wow, that sounded weird). That's certainly used in industry, though it may not be platform independent.
Any other reasons? I think the question comes down to whether a University should be attempting to teach a tool that's an industry standard, at the cost of a better quality of education. The programming language is just a tool, in computer science. It's important to know the tool, but if you don't develop the skills to solve problems, then you can't be a computer scientist.