Programming:The Good, The Bad and The Ugly

Jeff Yearout posted this bit of Python code in his blog.

def main():
print(‘Enter object types as t for triangle, r for rectangle, and s for sqaure.’)
print(‘Enter numbers only for dimension values.’)
print()
firstObjectType = input(‘Enter type of first object: ‘)
if firstObjectType == ‘t’:
h = int(input(‘Enter height of triangle: ‘))
b = int(input(‘Enter base of triangle: ‘))
object1 = triangleCalc(b, h)
print(object1)

def triangleCalc(base, height):
tArea = 0.5 * base * height
return tArea

def squareCalc(sideLength):
sArea = sideLength * sideLength
return sArea

def rectangleCalc(length, width):
rArea = length * width
return rArea

As soon as someone posts a bit of code on their blog the code geeks start making comments.  Both Mike Zamansky and I made our comments on the original code. I love it.  This is how I learn to code (or not to code, usually when someone comments on my code).  These little snippets and discussions are usually something at the high school level and usually target something simple.  Having teachers presenting alternative solutions for simple programs like this is great for the kids to see.

When learning or teaching from a book the book gives a solution and kids/teacher will assume that is the only and the correct or best solution.  The book does not explain why this is the solution offered or why out of several possible solutions this is the best.  With these little snippets and blog conversations the alternatives come up and usually the teachers commenting will talk about why this is a good or maybe even a better solution.  Most programming teachers have learned their programming skills on the job so their technique is either from the book they found to teach from or it is a bit primitive from learning the language by trial and error (me).  For most of us, this is the only way to improve our programing skills and understand the good from the bad from the ugly.

There is no such thing as professional development for programming teachers.  Taking a programming class at the local institute of higher learning is not professional development for teachers.  A teacher needs to see alternatives, bad code, good code and weird code kids are going to come up with that works.  A programming course does not do all that.  Brave teachers putting their code up for discussion does.

Advertisements

3 Responses to “Programming:The Good, The Bad and The Ugly”

  1. Alfred Thompson Says:

    Today I went over a project I assigned to my students. I showed them a bunch of ways to do it. Using both a for loop and a while loop for example. Then several ways they could set up the set of if statements. I don’t know how much or how many ways they “got” but my point was more that there were several correct ways to do the same thing. I hope it encourages them to try different things. If nothing else I hope is shows them that just because they did it differently from their friends they didn’t do it wrong.

    I’m lucky of course. I was a professional developer for many years and have two degrees in CS. SO I start from a larger base of knowledge than the average CS teacher.

  2. Phil Gardner Says:

    “There is no such thing as professional development for programming teachers.”

    There is!

    I also wrote this book for other teachers that found it difficult to get time away from their classroom, or for students that wanted to know more than they were getting in school:

    https://www.amazon.co.uk/gp/aw/d/0995791813/ref=mp_s_a_1_1?ie=UTF8&qid=1506491525&sr=8-1&pi=AC_SX236_SY340_FMwebp_QL65&keywords=learn+to+program+using+c%2B%2B+on+the+raspberry+pi&dpPl=1&dpID=51cCUaulDbL&ref=plSrch

    Blog here:

    https://program-using-gnu-cpp.blogspot.co.uk

    Phil 🙂

  3. Jeff Yearout Says:

    Thanks for the comments, guys, I do appreciate it! I recommend others do this too, because once you get over the fear/discomfort/ickyness of putting your work out there, the feedback is well worth it.

    I am doing as much as I can to build up my personal programming skills, but as Garth says, that isn’t really PD in terms of the HOW TO of teaching CS at the K-12 level. There isn’t a whole lot out there on that topic, but I think the networking built in things like this are as big of a help as anything.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: