Live coding or as I like to call it coding without a net is a wonderful way to teach.There was a time when I thought that having prewritten code that was pasted in during a demo was a good thing. You see it a lot in demos at events for coding professionals. It turns out that in a marketing presentation that is fine and dandy but for teaching it just doesn’t work.For one thing, it moves to fast. Students can’t follow it all. And secondly, it avoids making mistakes.
It turns out that making mistakes is useful. When teachers make mistakes students feel less bad about making their own mistakes. Programmers make lots of mistake. Getting very upset or feeling inadequate when one makes a mistake is a sure fire way to get burned out very quickly. So seeing a teacher make a mistake can be comforting.
Of course, what is really important is how the teacher reacts to making a mistake. The obvious advantage to making a mistake is that the teacher gets to model how to fix the mistake. A teacher will, I hope, read the error message and then explain it to their students. For some reason students have to be taught that reading the error message is helpful. That is strangely not intuitive.
I find that I make several kinds of errors regularly. The most common error is the typo. It’s amazing how poorly my keyboard it as typing what I mean. A great opportunity to point out that they computer is not as good at handling ambiguous spelling as people are. Typos are often a good reminder to slow down as well. Sometimes taking your time is the fast way of doing things.
I also get bit by the logic error. Now you would think that would not happen for a long time professional writing simple code for beginners. What tends to happen in real life is that the good idea fairy strikes in the middle of a demo and I decide to make the demo more interesting by adding something I have never added before.This turns into a great example of why planning BEFORE writing code is such a good idea. It is yet again a wonderful opportunity to model problem solving and debugging. Always take advantage of opportunities to model how to solve problems.
I teach several courses using several different programming languages so the other sort of problem I run into is using code for the wrong language. Visual Basic and C# (and JavaScript) declare variables differently and that seems to be a problem for me some days. As does remembering which languages use semi colons and which ones don’t. I haven;t figured out how to really take advantage of those errors. Any ideas? At least they don’t happen to often.
For me, I have decided to embrace the chances for mistakes. I’m not going to be afraid to make a mistake in front of my students. Life is to short and there is a legitimate upside to it. Now I have to make sure I can explain the error I made at the end of last class.
My typing skills are so poor that "live" coding is more like "die of old age waiting for me to type the code" coding.
ReplyDeleteA few years ago I was teaching Python, VB and Small Basic to three different classes. I was also transitioning from Python 2 to Python 3. What a mess. I could not for the life of me keep the syntax straight. I would pseudo-code something on the board then start to code it up. Half way through I would notice the kids looked really confused (more than normal). I would look at the board. Nuts, wrong language.
The Python 2 to Python 3 seemed to be the worst. Little changes were made that were just enough to really mess things up.
In the ~10 years of teaching Computer Science (more teaching math and engineerings) intro courses and AP courses I have always taught with live coding. It is not for everyone. I had no problem since I am an engineer and did just about everything in software engineering for ~25 years. My first tome I taught a CS course was a semester elective in Processing. I reconfigured the room into a monster Harness table. Kids faced each other and mostly everyone had a laptop. Kids loved this class. You faced each other and I projected my laptop with the Processing environment. In a short time kids were asking to be the “driver.” Even kids on lunch tried to crash my course cause it was “real.” It was not all about mistakes, but they learned from watching how “volunteers” would attack some snippets of code. We doodled on paper and whatever how to attack problems and communicate our ideas. Best is that we all modeled how real life teams work on tackled novel tasks and often we came across stumbling blocks. ... something other classes with every minute with prescribed slides could not do. The room was always packed. Yeah I got hell for not “teaching” the boring way at the front professing to them through my boring slides with perfect code where everything was beautiful and perfect. I would constantly be in debates with administrators who had no clue. The fact that my classes scored very well in my tests and standardized tests baffled the administration. The fact that they constantly turned away many students from this class might say something. Students want a realistic class. Yeah I had a topic and a good idea how to motivate the class to help me “discover” solutions, but they drove the class to learn computational thinking, algorithm design, debugging, design, redesign, iterative improvements, etc. Beware of clueless administrators. Yep I was told to put the chairs/tables back into a grid and it was overcrowded. One week later I was asked if I could put the class the way it was before. Kids loved the Harkness table Looking at each other and a computer and just talking and thinking and coding. After a while the kids finally realized they could help each other out and I came in to oversee common or big problem to address with a little auxiliary mini lesson which drove administrators crazy cause it was not in the lesson plan. Just In Time learning or Just In Tine teaching was anathema to them. Oh yeah I sometimes sat behind the computer wired to the projector mainly when we had a new topic too introduce it, but I backed off and would randomly sit on the perimeter of the “table.” Kids had no idea where I would sit ... ok that was funny. Live coding or live teaching any topic is a sign the teacher is knowledgeable and also confident to present and teach the material to newbies even with the periodic “mistakes”. Some deliberate some not. Beware administrators who have no idea what you are doing. Their ignorance can hurt your valiant attempts at reaching students and get them excited about CS.
ReplyDeleteHarkness table! I did not know it had a name. I always just called it the "sit in a circle and BS about math and see what pops up". Some of my math classes are small and work this way. Cool, new vocabulary.
ReplyDeleteThe Harkness Table, at least by that name, started here in New Hampshire at Phillips Academy in Exeter. Still the main model for teaching there. Works best with smaller classes of course.
ReplyDeletehttps://en.wikipedia.org/wiki/Harkness_table
Thanks Alfred (and commentators). Read this at the weekend and as a result have been live coding all week. Downloaded the sysinternals zoomit utility so I could annotate the screen as well. Has worked well for the students and, as a bonus, is a lot more fun for me.
ReplyDelete