The manufacturing jobs are not coming back, not in numbers sufficient to regrow the middle class. Let’s not even talk about coal.
With increasing automation in manufacturing plants, there is less need for human workers to do menial tasks that machines can do much faster and more reliably. Still, someone has to program those machines, and therein lies an opportunity.
But therein also lies another problem: kids today don't have ready access to a simple computer programming language with which they can readily get results with a bare minimum of mathematical knowledge and programming philosophy.
Three years ago, to mark the half centenary of BASIC, Time had an article that begun thus:
Knowing how to program a computer is good for you, and it's a shame more people don't learn to do it.
For years now, that’s been a hugely popular stance. It's led to educational initiatives as effortless sounding as the Hour of Code (offered by Code.org) and as obviously ambitious as Code Year (spearheaded by Codecademy).
Even President Obama has chimed in. Last December, he issued a YouTube video in which he urged young people to take up programming, declaring that “learning these skills isn’t just important for your future, it’s important for our country’s future.”
What's to be done about that?
QBasic
When I was growing up, QBasic was available on almost every computer with the Microsoft Windows 95 operating system. Sure, it was tucked away in the command line, but it was there, I could use it and I did use it.
QBasic is a variant of BASIC, the Beginners’ All-Purpose Symbolic Instruction Code. COBOL and FORTRAN were perceived as being specialized programming languages (for business and science, respectively), while C, the forerunner of C++ and C#, was certainly not for beginners.
Actually it looks like BASIC predated C, but from a pedagogical point of view, BASIC should precede C. I could copy BASIC programs from books and make them run in QBasic with just minor adjustments. For example, I copied a program to draw the Mandelbrot set and Julia sets.
At that point I wasn’t so interested in zooming in, so I optimized the program to take advantage of the symmetry to speed up the process. There probably would have been some major limitations to zooming if I had tried to implement it.
Back then I also made a little video game that looked primitive even by the standards of the day, I still have the source code on some backup drive somewhere.
It was an asteroid-blasting game. On Level 1, it would draw ten asteroids on the screen, and it was very easy to navigate your ship as to not crash into any of them.
Then on Level 2 it would draw twenty asteroids. Generally you’d have blast one or two asteroids in order to proceed to Level 3. I can’t remember at what level the asteroids would get so thick that there was just no hope of getting through.
Now that I know more, that little game looks woefully inefficient, even though it would run very fast on one of today’s computers, so fast that your ship would probably crash into an asteroid before you even had a chance to maneuver it out of the way.
I actually had four separate subroutines to draw the ship depending on which direction it was moving. Ten years later, I might have written a single subroutine which accessed a global variable to determine in which direction to draw the ship.
C++, Java
And today I would be thinking about encapsulating the ship’s direction in a protected or perhaps even private variable in the ship class. As the user presses one arrow key or another, an event listener would pass the appropriate direction as an argument to a function in the ship class, and not touch the ship’s direction variable at all.
The compartmentalization of the object-oriented paradigm is a good thing, it allows a team of programmers to work on a single project without all the problems that can ensue from global variables.
For instance, in my little asteroid game, the asteroids for each level of the game are completely static unless they are shot at. I could ask someone else to work on the asteroid field class so that the asteroids move in some way even if they’re not shot at.
This other person working on the program would not have to worry about making some change to a global variable which causes an unintended consequence for the ship navigation functions.
Of course that sort of sophistication and elegance is not possible in QBasic, you have to use C++ or Java. There are other languages, of course. I think Turbo Pascal and Fortran 90 have object-oriented features.
At least C++ and Java are available for free from the Internet. I installed NetBeans on my computer at home, and was writing Java programs very soon after installation.
I would not have found NetBeans on my own. I learned about it thanks to one of the very few black graduates from Grand Circus. Grand Circus is a computer programming school, the only one in downtown Detroit, and it has an even lower numbers of Latino students. I will elaborate on these suspicious details another day.
In order to use C++ through NetBeans, I had to install the Cygwin64 compiler, which was also free but required great patience and care, and quite a bit of command line tinkering with environment variables.
While it’s easy to get kids writing console applications in Java, the learning curve for programs with a graphical user interface (GUI) in Java is steep. Java in a Nutshell by David Flanagan mentions the abstract window toolkit (AWT) but refers you to his other book, Java Foundation Classes in a Nutshell, for the details.
I have successfully copied and ran AWT examples I’ve gotten from the Internet. But if you want to know whether I have successfully used AWT in one of my own programs, you’ll have to wait at least a few weeks. I’m still learning about the difference between light and heavy GUI components (AWT is apparently in the latter category).
Last night I thought I’d make some progress on my Java program to display diagrams of prime numbers in different imaginary quadratic integer rings. But in the time I allotted myself, I wound up dealing with the issue of a possible lossy conversion from double to int.
public void setRing(ImaginaryQuadraticRing iR) {
this.imagQuadRing = iR;
if (imagQuadRing.d1mod4) {
this.pixelsPerBasicImaginaryInterval = (int) Math.floor(pixelsPerUnitInterval * imagQuadRing.absNegRadSqrt/2);
} else {
this.pixelsPerBasicImaginaryInterval = (int) Math.floor(pixelsPerUnitInterval * imagQuadRing.absNegRadSqrt);
}
}
That looks inefficient now that I review it today, I’ll probably change it so that the floor function is used just once. Also, I might need to brush up on the keyword “this”.
The point here is that programmers have to mind data types. Two variables might both be numbers, but if they’re different kinds of numbers, it could cause problems. At the other end of the spectrum, the ridiculous flexibility of data types in JavaScript can also cause problems.
So there are still traps for the unwary without using AWT or any Java GUI package. Such as the InputMismatchException when using the Scanner to get input from the keyboard. This is pedagogically problematic since exception handling is rarely taught in a way that is easy to understand.
Microsoft Small Basic
In 2006, when I had mostly forgotten about QBasic, David Brin wrote “Why Johnny can’t code” for Salon. He has a son named Ben (and maybe other children), I don’t, so this deficit of BASIC on today’s computers is something that he is more aware than I am.
Brin talked to Microsoft about this issue, but nothing seemed to happen. Then, four years later, Vijaye Raji unveiled Microsoft Small Basic.
I’m guessing it's called “small” because it has very few keywords, just fifteen of them. Let’s try not to get bogged down on what constitutes a keyword, but QBasic has a lot more keywords than Small Basic.
Call them keywords or statements, but Small Basic has no need for QBasic’s BEEP, CLS, PRINT, PSET, etc. What Small Basic does is instead rely on objects that presumably come from the .NET framework.
It’s a very gentle introduction to object-oriented programming without the pitfalls that frequently trip up beginning and intermediate students of C++, C#, Java and other full-featured object-oriented programming languages.
With the GraphicsWindow object, for example, a Small Basic programmer doesn’t have to worry about whether to instantiate or subclass GUI components. But hopefully the concepts of data hiding and encapsulation won’t seem so foreign as they might to a former QBasic programmer.
I presume that Small Basic also provides form controls such as text fields and radio buttons. But the Small Basic programmer probably doesn’t have to worry about how to attach event listeners to such controls.
Another source of frustration, even for experienced programmers, is case sensitivity. Small Basic is almost completely case insensitive. Something like this will probably compile just fine in Small Basic:
tURtle.Move(selinTERVal)
Turtle.tuRN(newAngle)
Though it’s probably bugging all the Sheldons out there.
As for data types, Small Basic is even more flexible than JavaScript. In Small Basic, a variable is whatever data type you need it to be, and you don’t have to worry about forgetting to initialize a variable. Though I haven’t tested what happens when you try to multiply a string by a fraction, or divide 0 by a Unicode character.
From what I’ve been reading in the book Learn to Program with Small Basic by Majed Marji and Ed Price, Small Basic is aimed at children and teens. Some of the humor in that book reminds me of Jacob the Bar Mitzvah Boy (Vanessa Bayer).
Still, I don’t know if it’ll have the reach QBasic had in its day. As far as I know, it still does not come standard with any computers today. It is free to download, but you also have to have the .NET Framework installed (which is not a bad thing if you think your kid will go on to study Visual Basic or C#).
Wolfram Mathematica and Wolfram Alpha
Brin has seen lots of math textbooks with “Try it in BASIC” exercises, and surmised that textbook authors will very likely stop including those in the future.
An alternative is Wolfram Mathematica, or if the school can’t afford it, Wolfram Alpha. With several caveats, if you can do it in one line in Mathematica, you can probably also do it in Alpha. For example, suppose you want a few multiples of 24 sandwiched between primes:
Select[24Range[100], PrimeQ[# - 1] && PrimeQ[# + 1] &]
Mathematica syntax can sometimes look like Malbolge (an esoteric computer programming language used more frequently in modern Sherlock Holmes stories than in real life).
With Wolfram Alpha you can also do natural language queries like “list the first hundred odd squares”. But, Darmok at Tanagra, sometimes natural language queries in Wolfram Alpha will make you feel like Picard turned a kid (David Birkin).
JavaScript
Or maybe the solution to this quandary has been staring Brin and I in the face all this time: JavaScript. Almost every computer sold today comes with at least one Web browser, and almost always that browser is Javacript-capable.
And you can use JavaScript even without an Internet connection (that is certainly a problem for Wolfram Alpha, and sometimes for Wolfram Mathematica when you’re relying on a license server, since that program is designed to always check the license at startup).
There are problems with JavaScript as a programming language for kids to learn, though. For one thing, it’s also necessary to have a thorough grounding in HTML and CSS. When something doesn’t work, the problem might be in the HTML or the CSS rather than the JavaScript.
To my knowledge, all modern Web browsers have tools for debugging JavaScript. But these vary from browser to browser, or even within the same browser on different operating systems.
I don’t have the answers. To close for now, I leave you to ponder Brin’s warning:
We have allowed a situation to develop that is like a civilization devouring its seed corn. If an enemy had set out to do this to us — quietly arranging so that almost no school child in America can tinker with line coding on his or her own — any reasonably patriotic person would have called it an act of war.