Posted by hansmuller
on November 3, 2003 at 8:23 AM PST
Here's a demographic your marketing department hasn't been thinking about: Teenagers. I'm thinking that it's time to start thinking about what they're up against.
Last night my sons and some of their friends were visiting and one of the boys took me aside, said he had a question. He's 15 years old, very bright, and growing up in a world that's somewhat different then the one I remember. There are some similarities. There's a war on although fortunately there's no need for a teenager to worry about being drafted. Cars and girls seem to hold the same attraction as before however attitudes have changed. I hear this Good Charlotte (that's a band) lyric enough to be tired of it: "Girls don't like boys, girls like cars and money". So, desperately trying to channel Ward Cleaver, I braced myself for the inevitable question about the inexplicable. He said: "I have a question about Java".
Today's fifteen year old has lived with a mix of personal computers and networks since they were old enough to type ctrl-alt-delete. They've been schooled on desktop computers with mice and windows and GUIs and realistic 3D multiplayer first person shooters. Given so many rich ways to interact with computers, it's no surprise that few of them choose to learn how to write software. And yet, just like long ago, some of us do respond to that siren song, even if the most satisfying thing about the results is an obedient machine clack-clacking only-funny-to-a-child drivel on a teletype. I was faced with someone who'd had the patience to learn how to write Basic programs for a graphing calculator and who now had the desire to learn Java. He'd even bought a book on the subject that was tailor-made for teenagers, with advice about writing games and gags and lots of black and white pictures of silly programmers.
The book began with some simple instructions. Go to java.sun.com and download the latest J2SE SDK. This was no problem for our modern teenager and thanks to broadband, it didn't take very long either. According to the book, step two was to "add Java to your PATH". In your mind, imagine the sound of a car screeching to a halt and crashing into a brick wall.
First question: "what's a PATH"? I indulged in a brief description of command processing shells. This only led to obvious follow up questions which quickly forced me to confront the fact that, despite ten years of experience with computers, this teenager had never spent any time typing commands at the DOS shell. That's because he never needed to. Returning to the key question of how exactly to "add Java to your PATH" I was greatly relieved to find out that my student had already found a likely looking chat forum, asked about doing this, and within a few minutes recieved the proper incantations. Which was a good thing, since my memory of hacking the DOS PATH has me struggling to edit a long line of crytpic text through a small window
in some kind of shell environment editor dialog mess. For the last N years I've been using Cygwin and bash and although that's more familiar to me, I'd hate to have to try and convince a teenager of its charms.
As fate would have it, the fun was only beginning. Our Java programming book began with the legendary "Hello World" example. Creating the text in WordPad was easy enough, but where to put the file? No, not in the C:\J2DSK Folder (what's Java doing there anyway?), and not at the top level in the "My Documents" folder. I advised creating a HelloWorld subfolder for the app. More confusion about getting the "Command Prompt" started in the correct working
directory and then (finally) typing:
> javac helloworld
javac: invalid flag: helloworld
With hands waving I explain that javac isn't going to just guess that the file you're referring to is "HelloWorld.java". Software that can't be relied upon to DTRT isn't common in the teenage world of game consoles and web sites and chat clients; but we persevered. Sadly, it feels like climbing up a steep hill with a backpack. And the backpack just got heavier.
We return to the problem reinvigorated by the introduction of an actual shortcut - the arrow keys restore commands typed at the DOS prompt.
> javac helloworld.java
helloworld.java:4: package system does not exist
Gack. You have to realize that our teenager is bright and resourceful and so while I'm contemplating the injustice of being forced to explain what's gone wrong, he's busily comparing the text in the book with the text he's entered. It all looks exactly the same and that's frustrating. As I launch into an explanation of case sensitivity in Java identifiers while trying to avoid divulging what "System.out" means he begins to glance furtively towards the XBox in the other room. His brother his playing a game that involves racing around a city at night in a vehicle packed with large caliber weapons. There are explosions. The backpack we're carrying is getting heavier.
Back we go to the task at hand. This time we're successful and I think I detect a hint of pride as we view the newborn .class file. The book explains the finale simply: type "java HelloWorld". He types:
> java Hellworld
I suppress the urge to weep. It's not clear if my explanation about the difference between filename command line arguments and command line arguments that represent Java identifiers does any good. At this point the machine gun fire from TV in the next room is sounding almost seductive and the fact that I've made a career out of software engineering has gone from a source of pride to embarrassment. Yes, we do learn navigate through this thicket of details and gotchas. The backpack is feeling like it's crammed full of plutonium.
> java HelloWorld
In your mind, imagine the sound of a chorus of angels singing. As we stand atop the mountain, hurling adolescent variations of "Hello World" over the side, all seems well. Until I'm asked what the equivalent of the Basic command for generating a random integer between 1 and 10 is. The angels begin hacking and coughing. The singing ceases. I consider explaining what floating point numbers are, the rules for mixing types in arithmetic expressions, and what it means to cast an expression to an int. Then I consider playing games on the TV.
While we're blowing up cars people and buildings on the game console, I'm thinking about what this experience means. Growing the Java developer base is important. We can rely on classroom instruction for
some of that growth, and the migration of experienced programmers for some more. When I was 14, a PDP-8, Basic, and a Teletype were enchanting despite the fact that learning how to program was strictly do-it-yourself. Today's teenage computer explorer has very different expectations about the process of learning and I don't think we're meeting them. Learning the basics of programming with Java has got to be easier.
Here are a few things I think we could do to make it easier for someone without much experience who's interested in an introduction to Java programming. I'd like to hear what other people think. The most obvious thing to do would be to provide an alternate Java download for students that came with an easy to use IDE, like
BlueJ . I don't know of other IDEs or IDE plugins that are designed for the complete novice however I'm sure they're out there.
Learning by modifying small working programs seems like a good idea and it would probably help to defer trying to explain object oriented programming until the student was comfy with variables and expressions
and so on - just within the main() method. Examples that incorporate some bundled classes for graphics and animation would probably be more intriguing than variations on computing Fibonacci numbers. Finally,
trivializing deployment to the internet is an area that even professional developers could use a hand with. It would be great if the friendly IDE came with a button that uploaded whatever example the student was working on to a public internet site as an applet or a web started app. That way they could IM their friends and encourage them to try their creations and maybe convince them to experiment with building a little software of their own.