Is there a perfect way to teach programming to would-be programmers? Let's ask the
Magic 8-Ball.
Outlook not so good.
Does that mean we shouldn't teach them? Of course not. Does it mean we shouldn't look for better methods of teaching them? Emphatically I say again, "of course not!"
And what of the learner? Should beginners seek to increase their level of skill?
Only if they want to become a level 20 Spaghetti Code Slingmancer (can you imagine the mess?). Or, that's how some make it seem.
Photo from Ken Stein found via Spaghetti cables @ Geek2Live
All it means to me is that we shouldn't let our paranoia about the wrong ways of learning stop us from doing so. For instance, take this passage about the pitfalls of reading source code:
Source code is devoid of context. It's simply a miscellaneous block of instructions, often riddled with a fair bit of implicit assumptions about preconditions, postconditions, and where that code will fit in to the grand scheme of the original author's project. Lacking that information, one can't be sure that the code even does what the author wanted it to do! An experienced developer may be able to apply his insight and knowledge to the code and divine some utility from it ("code scavenging" is waxing in popularity and legitimacy, after all), but a beginner can't do that.
Josh also mentions that source code often lacks rationale behind bad code or what might be considered stupid decisions, and that copy and paste is no way to learn.
They're all valid points, but the conclusion is wrong.
Which one of us learned the craft without having read source code as a beginner? Even the author admits that he was taught that way:
Self-learning is what drives the desire to turn to source code as an educational conduit. I have no particular problem with self-learning -- I was entirely self-taught for almost three quarters of what would have been my high school career. But there are well-known dangers to that path, most notably the challenge of selecting appropriate sources of knowledge for a discipline when you are rather ill-informed about that selfsame discipline. The process must be undertaken with care. Pure source code offers no advantages and so many pitfalls that it is simply never a good choice.
This is a common method of teaching - "do as I say, not as I do." It's how we teach beginners anything, because their simple minds cannot grasp all the possible combinations of choices which lead to the
actual Right Way to do something. It's a fine way to teach.
But I'd wager that for all X in S = {good programmers}, X started out as a beginner reading source code from other people. And X probably stumbled through the same growing pains we all stumble through, and wrote the same crapcode we all do.
Of course, there are many more bad programmers than good, so lets not make another wrong conclusion - that any method of learning will invariably produce good programmers.
Instead, let's acknowledge that programming is difficult as compared to many other pursuits, and that there's not going to be a perfect way to learn. Let's acknowledge that those who will become good programmers will do so with encouragement and constant learning. Instead of telling them how they should learn, let them learn in the ways that interest them, and let's guide them with the more beneficial ways when they are open to it.
Let's remember that learning is good, encourage it, and direct it when we can. But let people make mistakes.
Learning in the wrong manner will produce good programmers, bad programmers, and mediocre ones.
Independent, orthogonal, and irrelevant are all words that come to mind. The worst it will do is temporarily delay someone from reaching their desired level of skill.
I would be knowledgeable having read programming books with no practical experience. But I wouldn't have any understanding.
Making mistakes is fundamental to understanding. Without doing so, we create a bunch of
angry monkeys, all of whom "know" that taking the banana is "wrong," but none of whom know why.
What do you think?
Hey! Why don't you make your life easier and subscribe to the full post
or short blurb RSS feed? I'm so confident you'll love my smelly pasta plate
wisdom that I'm offering a no-strings-attached, lifetime money back guarantee!
Leave a comment
I agree with your premise and would add one additional benefit of self-learning that an employer gets: passion. A developer that taught him/herself to write code has already displayed an interest beyond vocational.
When I'm hiring, that's one thing that I really want - someone for whom development and technology as a whole isn't just something they have to do 8 hours/day to make a living. I want someone that goes home and screws around with this stuff just because they're curious.
For that reason, I love self-taught developers.
Posted by
Rob Wilkerson
on Jun 16, 2008 at 06:51 AM UTC - 5 hrs
This is one thing in life that I think is relative. For some people, its natural for them to thirst for the knowledge to do something better (whether there is a better way or not). Some people you can coerce into learning. There are others where it is diabolically opposed (and it can even be subconsciously so they don't even realize it).
I am self taught, though like you say, I wish that I had someone (whether in a book/blog/person) to point me in my next direction. I would say that learning the concepts of programming is fairly straight forward, but implementing those concepts into several blocks of code was my weakness. I found that I had a lot of redundant code, because I didn't learn early enough to write a function to be called. I instead wrote it once and copied 5-6 other times to where I needed the same process.
I am still constantly learning something. I have a couple of people that are far more advanced than me that have helped point me in the right direction, but I lost a lot of time. The thing is, I don't know if I had learned through the traditional methods of universities if I would be any further along. Either way, I know that in a corporate environement I am overlooked because I don't qualify for positions. I wonder how I could manage in a smaller environment. I feel I would lose a lot of stability that is required when caring for a large family.
Posted by shag
on Jun 16, 2008 at 10:51 AM UTC - 5 hrs
@Rob - changing the subject a little, but out of interest: do you have a way to weed out the self-taught from the people who think that being self-taught will be a benefit, or do you find that people don't tend to lie about that?
@shag - Like you, for quite some time I thought "code reuse" meant that I could copy the code I needed from where I first wrote it and paste it into the place I needed it to be. "Copy and Paste Reuse" is what I like to call it now.
I don't think I coined that phrase, but I don't know who to attribute it to either.
Posted by
Sammy Larbi
on Jun 18, 2008 at 07:56 AM UTC - 5 hrs
@Sammy -
No, nothing specific. I ask a lot of questions about what s/he does when they're not at work. Do they run a home network, how its configured what other languages interest them and why, etc.
I don't really care whether they're self-taught, per se, but whether their chosen vocation is also an avocation (to paraphrase a Frost poem). I want to know that they actually like what they do and it's not just a way to make a living.
That make sense?
Posted by
Rob Wilkerson
on Jun 18, 2008 at 08:38 AM UTC - 5 hrs
@Rob - Absolutely. Makes total sense. Actually, that's probably the only way I could envision what you do, now that you mention it. =)
Posted by
Sammy Larbi
on Jun 18, 2008 at 08:55 AM UTC - 5 hrs
This is definately an excellent counterpoint to the conclusion I implied in my post -- and one that I basically agree with; I perhaps should have worded things better. I do think that learning (only) from source code is a pretty bad idea, but I recognize that nobody's ever going to get anywhere if they spend all their time screwing around trying to find the 'perfect' and 'correct' way to learn -- and mistakes are definately an invaluable part of the learning process.
Posted by
Josh Petrie
on Jun 23, 2008 at 08:28 PM UTC - 5 hrs
@Josh - Thanks for the comment. I wonder if mistakes /are/ the process, sometimes. It's a strong statement, and some learning can certainly take place without mistakes.
But mistakes provide the means for understanding: I might know that copying and pasting code is considered a bad practice. I might even /know/ what some of the problems associated with it are. But until I actually experience having to change a bug in the 20 places that I copied code to, I don't think I could say I /understand/.
Anyway, thanks for stopping by to leave a comment.
Posted by
Sammy Larbi
on Jun 24, 2008 at 07:00 AM UTC - 5 hrs
Josh linked to this over on GameDev, and I think it's a fantastic embodiment of a position I've come to embrace over the years - the reason I've encouraged people to abandon language wars entirely, because regardless of how you start and what you use when you start, so long as you start and work at getting better, you'll end up alright.
Thanks for another link in my "n00b arsenal," Sammy! :-)
Posted by Oluseyi
on Jul 01, 2008 at 12:07 PM UTC - 5 hrs
@Oluseyi - thanks for the encouraging words!
Posted by
Sammy Larbi
on Jul 02, 2008 at 07:33 AM UTC - 5 hrs
Leave a comment