Square around the screen again

Dan and I have come up with a total of 5 methods of programming this little problem.  There are undoubtedly a plethora of good solutions.  I gave this to my programming class to do in Small Basic.  SB is perfect for this kind of little assignment, it does simple graphics without any fuss.  I have three kids in the class.  Two solutions were very similar to the state variable solution, especially since I showed one kid what a state variable did and how it worked and he shared the idea to the other two kids.  I expected the same basic solution from all three kids.  Kid number three had to be different.  He turned in the code and I stared.  “What the heck did he do?!”  It took me a while to figure out he had come up with a recursive solution.  Very clean, very unique.  I love it.

If you are going to teach programming the cookie cutter has to go out the window.  In math there is usually a “best” method to reach the solution.  In programming there are good solutions and bad solutions, all of which will work.  And sometimes there are solutions that are just better than anything you may have thought of.  Smart kids in math are manageable, you know where they are going and what tools they have to work with to get there.  Smart kids in programming find tools you did not know existed and they will use them in ways you never thought of.  I love it.

2 Responses to “Square around the screen again”

  1. gasstationwithoutpumps Says:

    The notion that there is usually a “best” solution in math is an illusion,brought about by reverse design of the math problems, starting from a solution technique and looking for artificial problems that best exemplify that technique. For math problems that arise more naturally, there are often many solutions—some good, some bad.

    The programming problems you are starting with have not been carefully tuned over centuries to point to particular solution techniques, so are more like real math problems than the textbook examples usually taught in math classes.

  2. gflint Says:

    You are absolutely correct. I should rephrase that to be contrived high school text book math. Most real world math does have many routes to a solution and even the solutions can be different and correct.

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: