It is not enough to know how to write code.

It is not enough to know how to write code.  I am teaching Java for the first time this year.  No biggie, there is a first year for every teacher teaching a language.  We manage.  I have had a lot of first years: Python, Corona, Visual Basic, Small Basic, Gamemaker and it goes on.  In all cases I have had kids walk away with an understanding of how to write a program in the language.  What bothers me is knowing that they are not walking away understanding how to write a program in that language correctly.  (I do have kids come back to me after their first year in a university CS program saying they are well ahead of their peers so I am not all bad.)

This brilliant observation came to me yesterday as I am coding the latest Java assignment I gave the kids.  I can write the program, code it up and get it working.  It is just very ugly and I know there is a better way to write the code.  Could I learn to write “good” Java code on my own?  I doubt it.  I see the problem involving the fact I teach little kid languages like Scratch and Small Basic.  The code is simple because the language is simple.  There is no way to write “fancy” code in these languages.  Everything is pretty much brute force.  No local variables, no classes, no parameters, no nothing.  There is not a whole lot to learn about these languages coding wise.  Something like Java on the other hand has all sorts of subtleties and variations.  Yesterday for example I discovered two things not explained in the book I am using; “throw IOException” when reading a file and what an overloaded operator (+) does in certain circumstances.  Both discoveries involved hair pulling and lots of time lost dinking around trying to find what the heck was going on.

So what is the solution?  One option is to quit teaching big person languages like Python, Java and VB.  I admit I do not have the background to do a bang up job on these languages.  Not a good option in my opinion.  I may do one horrible job with writing pretty code with the correct OOP methodology but at least the kids get some of the syntax and learn the IDE.  Besides, I like learning languages that are challenging.  Learning something new keeps me out of getting in a teaching rut.  Even if I end up beating a problem to death with the baseball bat of the coding world it is still a solution that can be refined.

A second option is to take some programming classes at the local university.  Tried that but the classes I need are offered in the morning only and that pesky teaching job interferes.  I tried to get a “Programming for Teachers” course started for next fall semester.  I even had an instructor that was excited about offering the course.  It would have been on-line, which is a real biggie in Montana, and be offered for graduate credit.  I had about 20 teachers across the state interested.  The CS department chair was even onboard.  Budget cutbacks killed it.  How budget cutbacks kill a 20 student course that would only cost the time of a salaried instructor is beyond me but then lots of things are beyond me other than Java.

For my Java class I have been applying option three.  I have a CS instructor, Mike, from the university come over and teach the class a couple time a month.  Mike is one of our middle school parents and enjoys coming over.  He is a bit fried on college kids and likes working with my programming geeks.  He is a bit fast for the kids.  OK, he is a bit fast for me and I tell him it is the kids.  He takes our junk code and shows us how to do it properly.  Sometimes it makes sense, sometimes not so much.  This is an interim solution but it is the only thing I have at the moment.  I figure if he is able to come over for a couple more years I will have enough “good” Java to do a half way decent job of teaching Java.  Opps, I just remembered I will have no kids taking Java next year.  It is a Python year.  I will have to find a Python expert to come in.  By the time I offer Java again I will be starting from scratch.  Oh well. Mike’s oldest kid is an eighth grader so I have him for at least 4 more years.


4 Responses to “It is not enough to know how to write code.”

  1. zamanskym Says:

    On any given day, I’ll probably be doing Java in one class, Python and Javascript in another and then I might dabble a bit in Clojure, Hasell, or Elisp off hours. Even if you’re comfortable doing it the X way where X is a particular language, the context switching is a bear.

    To add a couple of other thoughts — some languages have style guides or other online resources for best practices and coding styles.

    I also use flycheck in my editor (emac) which nudges me to use a languages approved style.

    Beyond that stackoverflow and github are your friends when seeing how people do it in a particular language.

  2. gasstationwithoutpumps Says:

    Switching languages a lot is common for computer scientists, but it does interfere with learning a language well.

    I’d recommend getting fairly good at one language rather than doing a half-assed job with several. Once you’re good with one language, then adding others makes sense.

    I also recommend Python as the first language (after something like Scratch), as it is well designed for rapid prototyping—the only sort of programming that beginning programmers do. After a couple of years of learning Python, switching to Java or C++ to do large shared projects makes sense.

  3. gflint Says:

    Stackoverflow is getting me through the course with some style. Teaching programming is 10 more difficult than teaching math, requires 10 times the time but is 20 times more fun. If pulling your hair out and cursing at an inanimate computer can be considered fun. My wife just thinks I am going nuts.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: