Learning to program

When I posted about “What To Teach The Kids“, I desired to write this side-bar on learning how to program.

You see, the trouble with getting started in programming is it’s difficult. Usually you want to learn to program because you want to do something, but there’s a lot of things you have to get straight before you can do something. It’s frustrating. You have to learn programming concepts, like loops, if-decisions, storage, subroutines and the like. You’ll have to learn higher concepts like factoring and organization. If you’re doing object-oriented programming you have to learn that whole paradigm and perhaps start to understand design patterns. Then you have to learn some language and all the quirks that come with it. You’ll have to learn some sort of library or framework. Depending what you want to do, there may be other specialty frameworks or concepts you have to pick up on, like for games work. I mean, it’s hard to get started because there’s so much you must have in order to just get started.

So how can you get started?

It so happens some other folks are presently discussing this, here and here. I think they’re headed in the right direction but haven’t quite gotten there. But the direction really is nothing new.

Karel

Back in undergrad I took this “abstract” computer programming class that used something called Karel the Robot. I remember in grade school learning to program in LOGO, which was kinda neat but looking back I see it was poorly taught and taught without direction… what’s the point of making this turtle draw a star on screen? But that started the ball rolling. BASIC was cool and very functional. But Karel was different.

Karel wasn’t out to teach you a programming language or other hard skills. Karel was out to teach you the basic theory of programming. Karel’s a robot that lives in a grid world. He can do a few simple things like advance, turn left, detect a beeper, pick up a beeper and put it in his beeper bag (I always thought “beeper bag” was a cute concept), detect walls. Very simple things, but from those simple building blocks you were able to learn concepts. For instance, you learned about the notion of subroutines when you wrote the “turn right” routine implemented as 3 turn left commands. And so it would grow from there. Karel was deliberately simplified so you didn’t have to worry about all the gory details that programming truly involves, so all you had to focus on was concepts of programming that apply anywhere regardless of programming paradigm.

Karel’s been around for 30 years, and truly I think this is the way to start programming because once you understand the concepts — and can do so free of all the other complex dreck — you’ll “get it” and be able to progress a lot faster. Karel’s been ported to numerous environments and languages, with an attempt to keep the essence of Karel but also give a gentle introduction to the language. I’m of mixed feeling about that because it removes a basic tenet of Karel: the simplicity of worrying about other stuff. But for those eager to get going, it may not be so bad.

Still, the trouble with the Karel is you can’t do anything useful, but that’s the tradeoff: ease of learning vs. usefulness. Again, when people get interested in programming it’s typically because they want to do something. So how can we get them to do something?

Useful

I’ve looked around for ways to teach kids to program, that honors the real tenants of programming — perhaps simplifying but not dumbing down nor misrepresenting — but still lets them do something useful.

I found this product called Stagecast. I’ve only evaluated it, but it looks pretty neat. It’s visual programming. It’s very simplified, a lot of click and drag and so on, but it still is true to real programming. The real bonus is the feedback and results are immediate. The kids can see what’s happening and how it all works. There’s no need to edit 500 lines of code across 20 files, wait for it to build, fix compiler errors, build again, then try to debug it. It’s like my “fishing vs. catching” analogy: there’s fishing, then there’s catching… you can fish all day, catch nothing, and it’s still a good day fishing. But if you’re trying to introduce a kid to fishing, they want to catch and catch soon else they will lose interest. So for kids, you have to start out with “catching” and as they start to enjoy “catching”, inevitably they’ll discover what “fishing” is. So I feel the same can happen here with Stagecast… let them “catch” and immediately create things in a simplified way. If they truly love programming then they’ll start to see the restrictions and limitations of Stagecast and want to explore further (“I want to write an iPhone game!”) and so, then you can start to introduce them along the path to other languages and other things.

If I picked a more generic path, I’d say the next step might be to teach them HTML. No it’s not a programming language, but it’s still simple, teaches formal constructs and organization, how to look things up in references, and again you get results but still have to debug those results. If they want to do more, JavaScript could be a simpler language to learn. I’d also say a modern scripting language like Python or Ruby would make a good “next step”. But exactly where to go from here really all depends upon their interest and direction.

Of course, something like LEGO Mindstorms would be wicked cool too, if you can afford it. 🙂

Make it Fun

Getting started with programming is a daunting task because you have to lay so much foundation before you can do anything useful. I believe laying the core foundation of principles, through something like Karel the Robot, is a good approach to take. Then moving to simplified but immediately productive environments such as Stagecast makes for a good transition. After that, you just have to determine your goals and where you want to go. There are ways to get there in steps, you just have to be patient. 🙂

17 thoughts on “Learning to program

  1. What got me interested in programming (not that I do it for a living, but I do enjoy figuring out how to do a Hello World in new languages when I get a chance) was two things.

    Back when I was all of about 3 years old my dad got hired by a startup company as a programmer, and his employer loaned him a computer to take home to work off of (1981 or 82 there abouts I’d have to ask him to be sure), and I have distinct memories of sitting on my dad’s lap while he programmed. He wrote a tic-tac-toe game for me that LEARNED as I played it, so it got progressively harder to beat the longer I played. That started the interest….”how’d you do that daddy!!!”

    Not to many years later we bought a box of children’s books at a garage sale, and in that box were several very beat up books about a kid who used his futuristic hand held computer to program things on the fly to save the day. And the books contained actual programs that could be run in DOS with instructions on how to run them on your computer! That was fun, especially when my dad helped me figure out how to make them work better, or produce a different image.

    It just kinda stuck from there. I have to agree that the best thing is to make it fun, I really think that the tic tac toe game my dad wrote me when I was little started it all. I wanted to know how to do it! Way to young to understand the concepts at that point, but the want to know HOW definetly stuck.

    • Oh my gosh… those books… something about that rings a bell. A very vague bell, but rung nonetheless. Can you remember anything more about them?

      But you are right: fun is key. Something to capture interest.

      I actually discovered the Stagecraft thing some time ago but never got off the pot, in part my own intertia, in part the kids didn’t have interest. Well, I finally showed it to them after writing this post a few days ago and boy… they ate it up! I downloaded and installed the demo and Daughter has finished the tutorial (Oldest and Youngest have watched some but haven’t done the tutorials themselves yet). We’ll see how it goes. Demo lasts 120 days and if their interest rides that long I’ll buy it.

      We’ll see. 🙂

      • Not really, I know one of the books, the final image in the program was an eye…..something about being in the jungles of central America or the like. But I can’t recall titles or author, or main character’s name. When I graduated from college and was attempting to pack up all my stuff to move out of my parents’ house I remember digging through my old books trying to find these books, but to no luck. My parents didn’t remember what happened to them either. The books were really beat when we got them (covers falling off and the like) so I assume they just finally fell completely apart and got tossed out since my brother wasn’t interested in them.

        • Ah, bummer. It’s going to nag at me now until I can figure out what those were because yes, I recall reading similar books.

      • I might have to show my husband the Stagecraft thing. He keeps saying he wants to write games, but never quite gets the gumption to DO something about it. We don’t have a Mac, so an iPhone game is out, but he DOES have a Droid, so if I can get him started its not out of the realm of possiblity for him to create something that could be actually used!

        • Well, Stagecast isn’t going to get you started down the road to Android programming… it’s way too simplistic and far-removed in concept. It might be cool still to start with but… he might get too bored with it. It’s good for kids, but kinda basic for adults.

          I’d say if he’s got the patience, just head to the local bookstore. There are lots of good books to help out here. But I guess it all depends how itching he is to actually produce something. If he wants to produce then well, get a book on the Java language (“Learn Java for Android Development” is good because it’s about the Java language and focuses on the parts of the language relevant to Android, e.g. Swing is irrelevant to Android developers). Then go from there… lots of good “Programming Android” type books too.

          • He’s done a little Java, so that would work, I was thinking though Stagecraft might push the creative impusles a bit, and then when he’s bored and wanting to actually DO more with it go from there.

  2. Maybe you could recommend something for me. I’ve been a Windows sys admin for about 10 years. Never had a need to learn scripting of any kind though I can put together a simple batch file. I learned basic way back in high school but have not programmed since then. I find myself in a new position to become the “web guy” at my new workplace. They understand I’m starting from near zero. I’ve got to develop web sites and apps for them. I’m plugging into statistics software called SAS. I’ll be starting a dreamweaver class soon. It’s scary but fun too. A lot more creative than sys admin. I’ve got an electronics background so I’m familiar with logic. It’s usually the syntax that trips me up. The guy that’s leaving said to start with HTML. Your thoughts?

    • I’ll do the best I can to make a recommendation here, but this is actually a bit outside my realm because I’m not a “web app” guy. Still, recent events at work have had me researching modern web-app stuff so, I can at least share what I know.

      Yes without question, just learning basic HTML is the first step. But these days, websites go far beyond basic HTML. You’ll need to learn JavaScript (not Java, JavaScript… Java MAY be an issue later, depending what you’re doing at work, but JavaScript is something else entirely and key to making modern dynamic websites). When you do HTML, you’ll also need to learn CSS — HTML is what to present, CSS is how to present the HTML (make it pretty), and JavaScript adds dynamic logic to it all.

      From there, you’ll probably pick up on things like DOM, probably some XML, Ajax… XML wouldn’t be too hard to pick up on either. After that well… you should have a good feel for things and be able to figure out what specifically you may need to do next that’s relevant to your job. For instance, you may need to learn a new scripting language like Python or Ruby to help hook up the web stuff to SAS…. or there may be some JDBC interface to use, I don’t know what your setup would be there.

      I’ve been going through this website: http://www.w3schools.com/ to get a crash course in these things. The site is very bare-bones and direct with its approach. I liken it to getting a “crash course in survival language”… like if this was a speaking language, say Korean, you’d run through their lessons in a matter of hours or days, then you’d have enough language skill you could go to Korea on business, be able to hail a cab, get to your hotel, find food, ask where the bathroom is, and get back to the airport… enough to get around and survive, but in no way really fluent in the language. BUT, you’ve got some foundational skills, enough to get you going and you could certainly see where to go next, how to go deeper, and get your ball rolling. And it’s free (I’d avoid their “certification” stuff… doesn’t seem worth it).

      Hopefully that might help to get you going. 🙂

      Good luck!

    • ( I have a degree in Graphic Design, we had to understand the basics of web design though its been a while since I did much with it)

      Start with HTML, then definetly CSS and Javascript. Once you’ve got that XML is easy. Actually HTML is easy if you’ve got the logic to start with. Dreamweaver is a great tool to use for web design too.

      I also suggest the following sites:

      http://www.westciv.com/style_master/academy/css_tutorial/index.html (they try to get you to buy their book, I never have, the stuff they have online is plenty usefull)

      http://www.web-source.net/html_codes_chart.htm (some HTML help)

      http://validator.w3.org/#validate_by_upload (a site to double check your code, just because it works doesn’t mean you didn’t miss something stupid that’ll blow up in someone’s face because they’re using an old brower or something)

      http://www.webmonkey.com/2010/02/color_charts/ (a list of HEX color codes)

      http://web.njit.edu/~kevin/rgb.txt.html (RGB & HEX codes)

      http://no-nonsense-software.com/freeware/ (scroll all the way down to the bottom, a nice little piece of freeware that’ll give you RGB & HEX for any color you can come up with, I’ve been using it for at least 10 years)

      Don’t be afraid to pick up a (reasonably newly published) book on basic HTML, CSS, and the like, yes you’ll probly end up well past them, but I found them massively usefull for basic reference when I was doing web work regularly, it was always the common easy stuff I forgot.

      If your work will cover it (or you don’t mind springing for it yourself) definetly work your way through classes on all of the above too.

      You’ve got a head start over alot of people though since you’ve already got the logic and basic computer smarts to start with!

  3. That mirrors much of what the guy I’m replacing said until you got to the part where you talk about DOM, XML, etc. That’s pretty interesting to though. One of the weak areas we have is being able to hook up with SAS in a meaningful way. I know it has it’s own HTML spitter outer module so there has to be a way to hook into it and go to town. It’s just weird having so much computer experience and feeling like you know nearly nothing about the area you’re to work in! I too found that w3schools site and dove into the HTML lessons about 2 weeks ago. It has been a very good place to start. It’s just a little shy on explanations that help you fill in some blanks as you go forward in some areas. Sounds like HTML is ground zero then. Thanks!

    • I know what you mean. I’ve been programming for a large portion of my life, but man… the last time I seriously looked at HTML was when the tag was cool. So not really understanding things like JavaScript, CSS, etc… I feel really out of the loop. I mean, I dabbled here and there, but never truly “grokked” the stuff. Recently changed all of that so, I’m happy.

      w3schools is very shy on explanations, so like I said, it’s just a survivial crash course, but it’s enough that you can say the stuff isn’t Greek to you any more and from there you can do what you need to do.

      Looks also like Ruth gave you some good pointers, so hopefully you’re on your way!

  4. Pingback: Learning to program | Stuff From Hsoi

Comments are closed.