Wednesday, November 28, 2018

Ready, Fire, Aim–Why Is Design First So Hard To Learn?

“Hours of coding can save you minutes of planning”

We’re talking about top-down design in my APCS Principles class this week. I gave the students a worksheet (part of the code.org curriculum which is really well done) that asks students to pair up and design the functions they would write for a given problem. The first question from a student? “Do we have to do the design before we write the code?”

Now you may be asking yourself – what sort of question is that? Of course you design first. That is not how students think some times. They want to jump right in and write code. It’s not that they know how to do it or that they have a design in their minds though. They want to try things and see what works. They are more into trial and error. They have high tolerance for error as long as they are moving forward and the development environment is not giving them error messages.

Now not all students are resistant to planning. Over time most students come around to the idea of design first. It can be a tough sale though. Design doesn’t have the same instant gratification that writing and trying a line of code does.

Back in the day (yeah, old guy reminiscing) we had long turn around between writing code and seeing results. We handed in our deck of punch cards and waited (hours or even days) to find out what worked and what didn’t. We really could not afford to skip the planning phase. We thought deeply about how things should work.  We closely desk checked code before submitting it and after getting early results.

Now I am not saying I want to go back to those days. (even though in weak moments I might think it would be good for students.) I do wish it were easier to keep students from writing code first though. I’ve tired having one student write a design and than having another student write code from it. The second student tends to mostly ignore the written design and do it their own way which may or may not look like the design at the end. Often it is easier to blame poor design than a failure toe follow the design. Students do want their programs to work and they don’t want to make peers look bad.

What I am trying to do more and more is to model design thinking myself. We create programs as a class and I work though the design before showing code. For example, we are working on a program to give and score quizzes. We worked though a discussion of what a question class would look like. What data would it store, what functions would it need to support, and how would it be used?

I can force students to write out designs. And they’ll try. Over the years though what seems to influence students most is what they see me do.  If I get lazy they’ll get lazy. If I take shortcuts they’ll take short cuts. If I use good practices though so will they. If I model design, planning for expansion, and show that I am thinking beyond the near term so will they. I keep reminding myself of this.

Leading by example is the best tool of all.

2 comments:

Anonymous said...

So true and well said! While I love to see student enthusiasm, encouraging them to take a step back is needed.

The "think out loud" method seems to get some students to plan, but it is hard to slow down a confident student that gets most programming challenges right away. I find that some of the sites like projecteuler.net and open.kattis.com with problems that are more challenging show some students the need for planning.

Garth said...

Kids want to be at the computer working, not at the table with pencil and paper. I also started in the punch card days were programming was not an immediate result event. Wouldn't this be a crazy idea, have a delay on the computer output of say 2 hours? Drawing a house with the turtle? Find out your programming result tomorrow! No more trial and error at the keyboard. Probably not be a big seller. I hear so many times "the kids today ..." and then some statement regarding patience or expecting instant gratification. I think those same kids were around in the punch card days, they just were not working on computers. So how do we get planning to be a first step? Lots of experience is the only way I can think of. By the time they are in their 40s or 50s they might realize the importance of planning. Winging it is just so much fun