Small Basic and more fun with Python

I am always looking for simple programming ideas to give to the kids that make them think and are doable in a couple of class periods.  This little square around the screen is in the general idea.  I figured I would have the kids do it in Small Basic, teach the state variable idea then have them do the same thing in Python.  We had done the traffic signal program earlier this year so the concept is a refresher.  It took me 30 minutes to get it working in SB.  The trouble is I am teaching a Python class.  Python does not have built-in shapes or sprites that animate easily.  You have to use pygame.py or graphics.py.  Both are version sensitive.  Neither is plug and play.  Neither is a nice simple install that the kids could figure out on their own.  The install directions are written by an expert for experts.  So I decide to use pygame to do this exercise.  I am using Python 3.4.  Need the right pygame.  Pygame for 3.4 in not in the usual pygame site.  Search the web.  Find the right pygame.  Delete old version of pygame before installing new version.  (Took a while to figure this little detail out.)  Three hours later I sort of have the program working.

After I get it working in Python I kind of sat back and looked at the process I went through for the last few hours.  Not the coding, that just require picking through the book to get the syntax and working slowly through the programming logic, but at the process required just to get the Python resources ready to go.  I think I can say I could not tell a kid to get this little program working in Python without giving them a whole lot of setup help.

The Small Basic package just makes life so much simple for the classroom teacher.  No install issues, simple IDE, simple documentation, no fuss, no muss.  For a classroom teacher being able to not have to worry about setup, versions (2.7 or 3.5?), multiple IDE choices (Eclipse, PyScripter, etc), and extra packages (pygame, graphics, …) that need to be loaded to do graphics, sprites and so on, is just a huge life saver.  No dinking with the registry and no putting path names in the environmental variables (both things that the average classroom programming teacher would not have access to anyway).

Picking the right language to teach intro programming can be a big decision for a teacher and a curriculum.  You really cannot lose with Small Basic.  Yes, SB is missing some fancy features; parameters, class building and local variables are the big ones I can think of, but those are sort of nice to be missing.  When you reach a point where those are really needed it is time to step up to Java or Python.  I sometimes think the perfect programming language for teaching would have a switch to turn these added features on.  But then the teacher might be tempted not to teach other languages.  Now that would be a big mistake.

Advertisements

3 Responses to “Small Basic and more fun with Python”

  1. gflint Says:

    Oh, and before a Python aficionado mentions it, I know I could do this without pygame, I was just trying to use a sprite. Draw the square, erase the square, move the coordinates, draw the square, … just lacked style. I may have the kids do it that way just for the exercise.

  2. danschellenberg Says:

    I’m not sure if I count as a Python aficionado, but you made me want to try this in Python. I ended up doing a version using the built-in turtle graphics module, as well as a version in PyGame Zero.

    http://dan.schellenbergs.ca/2016/03/22/moving-square-in-python/

  3. gflint Says:

    Being stubborn and not having a life I got the thing going with both the pygame and graphics.py. I love these little “shorties”. The code is simple but there are just so many ways of doing it. Dan’s solutions just demonstrate more teaching points available in this simple little project.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s


%d bloggers like this: