Block Design Patterns

"BlockDesignPatterns" are DesignPatterns at the level of a block of code.

Skilled programmers know them like the back of their hand.

A block design pattern is easy for a programmer, like hitting a nail into wood is easy for a carpenter.


Have you ever tried to teach someone how to program? Someone who never knew how to program before?

I have; I taught programming for free for 2 years to the general public. Usually had 5-7 people per night.

And I saw people struggle with these things, things that we think, as programmers, are very trivial.

I've seen intelligent Chemistry majors struggle with things like NestedForLoops. I was talking with one, he had a homework problem. He knew he had a grid to multiply over, but he didn't make that connection between "I have a grid of data," and "I need a for loop inside of a for loop." (Yes, he knew math and could draw upside down A "For every"s. The thing is, that knowledge wasn't connecting here.)

Now, one response to this is to say: "Programmers are Logical people, and other people are not. Programmers are left brained, other people are right brained. Thus, the reason they are having problems, is because they are not logical, like we are."

That's an idea, and it may even be true, but it doesn't seem to lend much in the way of actual help in teaching programming.

What I propose is that we collect common BlockDesignPatterns, and, when the occasion comes to teach, see if people can learn them.

My experience with DesignPatterns was very good. I believe that I got better at recognizing what approaches can meet what problems, because I studied design patterns.


I can imagine that someone learning programming could say:

"Okay, I have this problem. I have to multiple every number in this grid by 3. Let's see what I have in my toolbox."

"Is this SequenceOfCommands?? Is this NestedForLoops? Is this ControlTable? Is this VariationWithinLoop?? Is this PointerIndirection??"

To do this, we'd have to step back, remember when we were first learning to program, and think about what difficulties we had. Or, we have to study what problems learners are having. (Probably best.)

But, I think that if we do this, we could build a canon of basic BlockDesignPatterns. And then we could teach them, and people could come up to speed much more quickly.

When people have names for things, they become more real to them. The way programming is usually taught, it's like this: "Here are the basic elements of the programming language. Now make something that does X."

And then all the students who didn't program before- they struggle hard with it. Only a very few pass. I think we can do better: I think we can teach in such a way, that everybody passes.

By cataloging the type of thinking that successful programmers know at the block level, I believe this understanding can be transferred.

-- LionKimbro


Good idea. How about naming the patterns based more on what they do, rather than what they look like? This might help non-programmers grok them faster. Speaking of naming, I'm not sure that "Design" is the right thing to call these - is perhaps "Code Block Patterns" better?


EditText of this page (last edited August 12, 2009) or FindPage with title or text search