Learning by mistake

January 2, 2017

It is a method.  It is a long, slow and frustrating method but it does work.  For example my latest project is learning Unity.  Unity uses C# as its scripting language.  No big deal there, I know enough C# to get me in trouble so I should be OK.  I am learning through doing so I am building a little 2D platform game just as a learning exercise.  I got the basics down so I figured I would get cute and build a recycling elevator to carry my little character up to a higher platform.  Many hours and several days later the elevator still drops like a rock.  No continuous up and down like I want it to.  I have perused all the Googled suggestions, tried all the sample code and even, at this point, understand the code.  Owl boogers.  This should work.  I am at the point of just staring at the screen.  It works!  (The staring at the screen part, not the elevator part.)  Somehow I made my elevator platform a Rigid Body.  Rigid Bodies are subject to gravity.  If the platform is subject to gravity it falls off the screen.  I kill the Rigid Body component and the elevator works.

How has this helped?  I rewrote the code in about 5 different ways and I understand them all.  Before I was just cut-and-pasting with only a vague understanding of how this worked.  I know to watch out for the Rigid Body thing.  I know after hours of trying different code and scattering print statements all through the code to see what is happening that sitting back and staring at the screen is not a bad thing to do.  I know that even though I spent many hours trying to find the solution when it was actually something really simple having nothing to do with the code I was troubleshooting, I came away knowing a lot more than I did going in to the problem.

I also learned that although making mistakes like this leads to great learning experiences, it is still a royal pain in the ass.

Now I have to figure a way of teaching this technique to my students in a way that they do not think I am more of an idiot than they already know I am.

December 21, 2016

So I am happily going along with my one Python student teaching him what I know of Python (admittedly not much but it is an “easy” language and I have several books to learn from).  In my naive confidence that I can learn anything I decided to teach/learn more about recursion.  I have this little program that converts base 10 to base 2.

  1. def binary(n):
  2.    if n > 1:
  3.        binary(n//2)
  4.    print(n % 2,end = ”)
  5. dec = int(input(“Enter an integer: “))
  6. binary(dec)

I think I see how this works so we start to tear it apart.  We are OK with the “//” and the “%” operations.  Into the recursive loop we go.  Surprise!  I cannot figure out how it works.  So I do my usual thing when I cannot figure out some code, I throw in some print statements.  This method is tried and true.  It has clarified code for me for many years.

  1. def binary(n):
  2.    if n > 1:
  3.        print(“first”,n)         # added this for testing purposes
  4.        binary(n//2)
  5.        print(“second”,n)  # added this for testing purposes
  6.    print(“third” ,n % 2,end = ”)
  7. dec = int(input(“Enter an integer: “))
  8. binary(dec)

I input 22.  Here is the output.

first 22

first 11

first 5

first 2

third 1second 2

third 0second 5

third 1second 11

third 1second 22

third 0

Lines 1 – 4 are just fine, the recursion loop.  From there it goes to hell in a hand basket.  I do not understand how it even gets to the “second” print statement.  I had to call in the “Pro from Dover”, a friend of mine who teaches programming at the local university.  He emailed me how it works.  Nope.  It still was real fuzzy.  He is going to come over after the break and have a recursion sit-down with my student and I.

I actually like hitting things like this.  If I knew how to do it all what fun would that be?

Are you smarter than a sixth grader?

December 15, 2016

Tuesday in my middle school coding club I introduced the sixth graders to Lightbot.  Lightbot is a little online coding game.  It is a very simple game in concept.  Make the little robot move and jump and when it lands on a blue square turn a light on.  The coding language consists of little drag and drop icons, forward, right turn, left turn, jump, teleport and light on.  If you have too much spare time on your hands and love solving puzzles have at it.  Caution, it can be addicting.  I am happily going through the puzzles on the projector thinking the kids are working them along with me.  I ask one of the kids “Do you understand this one?”  He answers “I finished that one 10 minutes ago.  I am 3 ahead of that one.”  Everyone was ahead of me.  And I could not catch up.  Is there something wrong when a sixth grader can solve the puzzles several times faster than I can?

I went home and had a glass of wine.  Sixth graders cannot do that yet.

Base conversion program: always a good time

December 9, 2016

I only have one student taking my Python course this semester.  He is doing it pretty much independent study because I teach my senior Stats class at the same time.  The format is I lift some assignment from the book or I dream up something that will target what I want him to learn.  He is self-driven so it works out pretty well.  My latest idea to kill several birds with one stone is a program to convert bases.  I only want to convert bases 2, 10 and 16 just to keep it manageable.  It would be a two-part assignment.  The first part would just take the inputs through the usual Python input statement.  The second part would be to build a GUI with tkinter so there would be two sets of three radio buttons to select the conversion.  No big deal.  Should be doable.  There is a learning objective of understanding bases, learning and understanding a new package, the coding aspect and the algorithm development aspect. All reasonable I initially thought.

The student had not dealt with bases in a long time so we did a quick review.  While doing the review I noticed a pattern I had noticed before but diligently ignored before.  Converting from base 10 to any other base is not a big deal.  There is a nice algorithm.  Converting any base to base 10 is no problem.  There is an algorithm.  Converting base 2 to base 16 or the other direction directly is a big problem.  What I had noticed before was on any conversion I had always had base 10 involved.  If I wanted to convert base 5 to base 8 I always converted 5 to 10 and then 10 to 8.  Going directly is not so easy.  For example, convert 42 base 5 to base 8.  Converting the 2 is no problem, it is the ones place and ones are ones so long as the starting base is less than the destination base.  (Going the other direction, bigger base to smaller base is going to require an addition to the algorithm to handle when the ones are greater than the possible values for the destination base.  Convert 47 base 8 to base 5 for instance.  There are not 7 ones in base 5.)  The tricky stuff starts when trying to handle the 5s place.  40 base 5 = what in base 8?   4 * 5 = x * 8.  Still kind of using base 10 but not quite so directly.

As I type this I can see an algorithm taking shape.  The trouble is I do not want to teach the student my algorithm.  What I have to figure out is not the algorithm, but how to teach the student to develop the algorithm.   I am trying to avoid the standard math class teaching process; here is the algorithm as handed down from on high by the mathematics gods, memorize it and use it over and over until you have it ingrained in your memory.  I have a friend that teaches CS at the local university.  He states that his classes are full of kids that can program but almost none of them can solve coding problems.  Thinking and algorithm development are CS requirements.  Two things that kids hate to do and teachers hate to teach.  Both are very hard to learn and teach.

Well back to thinking.  And on a Friday at that.  I am a glutton for punishment.

Google VR. Ohhh, shiny.

December 2, 2016

I admit it, I like shiny objects.  A new shiny object comes along and I have to go look at it and play with it.  I like shiny objects in my programming classes.  Shiny objects attract students.  My latest shiny object is Unity.  I have been poking through the tutorials as mentioned in my previous post and decided this is one of the best shiny objects I have ever seen.  Then I stumbled on Unity with Google VR (Google Cardboard apps).  It is now so shiny it is blinding.  I found this tutorial (https://www.youtube.com/watch?v=AFGOhZJwoFw) on how to make Google Cardboard apps.  Ohhh, super shiny!!!

Now the question is: is this really programming or Computer Science?  I have to admit that I do not think it is the traditional concept of either.  But oh boy does it get the kids interested in the field.  It gets the kids wondering what else is out there that can take them in interesting directions.  Traditional programming and CS is not for everyone.  Just look at typical class sizes in a high school Java or Python course.  The percentage is real low.  I have said many times I am not training programmers in my classes, I am teaching kids how to learn to program.  (I am not a good enough programmer to teach programmers.)  I want my kids to come out of my classes saying “That was interesting.  Maybe I will take a closer look at CS/programming to see what else is out there.”  Unity is a hook.  Set the hook deep enough and maybe they will stay with it.  With shiny objects like this I can hook a whole lot of kids that normally would never look in this direction.

I will not retire my Python and Java courses, they still have their place for the kids that are really into programming but with Unity and Lumberyard (my next learning project) I can get a whole new population of kids thinking.

Unity again

November 11, 2016

I found a nice set of YouTube videos by Dawn Dupriest (search YouTube for “Unity and VR in the classroom”) on how to make a very basic maze game using Unity.  She has four videos that do a simple job of walking through the basic process.  There are a few glitches were Unity was not cooperating (the collision box handles were missing when I tried to resize the box but a little Google work found the issue) but the videos themselves were spot on.  I am going to throw this at four of my sharper students and see how kids handle it.  There is such a big difference from me working through these things with my years of working through things, and their limited number of years of working through things.  If I am going to give this a try next semester I want non-experienced kids doing a pre-run.

A couple of years ago I tried using the tutorial on the Unity site.  Too many leaps of assumed understanding.  I see they have been redone so after completing this series I will try them again.  Too many tutorials are just a list of tasks without any explanations.  This is fine if you do not want to do more than the tutorial.  A little bit of “why” goes a long way in really understanding what you are doing.

I already found one issue.  I have the kids working on some school tower computers because I can setup dual monitors on them.  The towers were on the school domain and only admins can save on domain computers.  Opps.  I pulled the computers off the domain and just made a workgroup as the easiest solution.  This is not an issue with BYOD or the school laptops (school laptops are not in the domain) but dual monitors is a must when doing video learning.  My older laptops have a VGA output so I could have dual monitors on them but the newer i5 laptops have HDMI only.  I do not have HDMI monitors, adapters or cables.  So towers it is.  Something to consider if I want to do a Unity class.

Unity is just such a tempting environment to teach.  3d objects, game feel, C#, make cool things; what more could you want to get kids into coding and problem solving?  Admittedly it looks and is pretty intimidating, lots of things going on and lots of stuff on the screen but for the sharp kids I think it is doable.  I just want the kids to learn how to learn.  Follow directions, read, and when the tutorial and book do not seem to jive with what is happening on the screen, to be able to scratch their head and figure it out.

First Game Programming Course and misc stuff

November 1, 2016

This semester I offered a game programming course.  Fourteen students signed up, freshman to seniors.  Only one girl.  I started the course using Gamemaker with Ben Tyers “Gamemaker Studio Course: Space Shooter – Level 1”.  The book walks the reader through making an Asteroids-like shooter game by using the coding language built into Gamemaker.  (Gamemaker also has a drag-and-drop programming environment.)  The book is intended to be used as a high school level text book so the progression level is supposed to be somewhat gradual.  We got through Lesson 3 and I decided to switch to a different language.  There was just so much left out of the book it was extremely hard for the kids to do any of the assignments.  The book would show the basics of programming but would not give enough on how to use what was learned.  I was also not to enamored by the Gamemaker programming environment.  Lots of moving parts and not enough “why”.  I do think that given enough time to write my own material to add to the book a course could be designed around Gamemaker.  It does teach programming with tradition line code but I am not sure the other requirements for building the game using the Gamemaker interface would lead to being successful in other, more tradition languages encountered at the college level.

So we are going with Corona for a while.  Corona SDK is a very traditional programming language for making apps and games for Android and iPhones.  Corona is just a front end for the language Lua.  Corona adds the physics and handlers needed for a touch screen gaming environment.  Like Gamemaker, Corona is just 2D games but the coding is much more to my old school liking.  I will be using Brian Burton”s “Beginning Mobile App Development with Corona”.  Again the book is intended to be a textbook so there are assignments and discussion.  Compared to Tyers book the chapters are much more complete with fuller explanations of the ”whys”.  Being a more traditional language I think it will lead to a better understanding of other traditional languages like Python and Java.  (These two seem to be the big two when it comes to programming in intro college CS courses.  Why do I not just teach these two if I am trying to prepare kids for college you may ask?  Because making games is fun and the course title suckers the kids into my class.  Yes, it is possible to make games with Python and Java but the level of difficulty seems to be a lot higher and the games are not as cool.  Some of the students are a bit surprised when they discover making a game involves much more work than playing a game.  Surprise!)

I have been working through Burton’s book for the last few days.  All I can say is it works.  You cannot ask for much more from a book.  As can be expected there is a lot of explaining to do to overcome the “assumptions” authors seem to make but so far nothing major.

I am going to do a coding club with 6 – 8 graders for 6 days once a week after school starting this month.  I want to do Corona but using the book is out.  Just not exciting enough for middle school and a bit dry.  So I started digging.  Now a good place to dig is the product’s website.  I had a successful dig.  Under Learn > Getting Started > Create an App is just what a middle school coding club needs.  Build this simple little game where you touch the screen rapidly to keep a balloon from touching the floor.  The really nice thing about the tutorial is that it explains every line of code.  There is a second tutorial on how to build a simple asteroid shooting game and again it is perfect for middle school.  It is definitely a step up from the balloon game but not so bad it is going to bury them.  Since I do not deal with middle school kids much these little tutorials are going to be life savers.  Building little phone app is also a really big hook for when these kids show up at the high school.  Sort of an introductory drug.

It is amazing how the number of students increase when you change the name of a course from “Introduction to Python” to “Introduction to Game Programming”.  Now I am sure there are some experts out there that will flap their hands above their heads and protest that I am not teaching language X so my students will not be ready for a college programming course.  Nope, I am not.  I am teaching them why programming is interesting and why it can be fun.  That might temp them into a college programming course with a positive look at programming.  I do have a book on writing games in Python.  There is just something different from writing a number guessing game and writing an asteroids game you can put on your Android phone.  Maybe that is just me and every middle and high school kid in the world.

I have been looking at different editors for Corona.  I have used Outlaw IDE the most but I notice it has not had an update since 2014 and the company seems pretty dead.  I am now looking at ZeroBrane and Sublime Text.  Neither is quite as nice as Outlaw for file management (Outlaw is drag and drop) but both are active products.  Sublime is definitely the most visually pleasing of the three.  I am going to need something easy for 6 – 8 graders to use.  “Full featured” usually is not a good thing with beginners.  (One of the reasons I like Small Basic is the editor is as simple as a brick.  Nothing fancy, just enough to do the job.  I was considering using Small Basic for the coding club but writing a phone app that they can actually put on their phone pegs the cool meter to the super cool pin.)

I cannot believe I volunteered to do that 6 – 8 coding camp.  I have enough trouble communicating with high school kids.  Oh well, it is important to have the occasional social challenge every now and then (besides being married that is).

Teaching with Windows 10

October 13, 2016

This summer I switched the school computers from Windows 7 to Windows 10 with the thought the kids should use what they are most likely to encounter in the “real” world.    In other words, I had good intentions.  It is an operating system, what could go wrong?  Zoiks.  The updates is what could go wrong.  I use mostly non-domain computers in my classes.  Loaner laptops the kids can take home or the kids use their own laptops.  Let it sit for a day or two, turn it on and there is an update downloading.  Some of the kids know how to turn off the auto-update feature, some do not.  I have tried to turn off the auto-update on the domain computers through Group Policy but for some odd reason it does not do to much.  This is one of those lovely unplanned things that can throw a class schedule off.  Today one of the kid’s loaners started an update when he turned it on at the beginning of class.  It was still cranking 90 minutes later.  He did not get much done.

Interruptions like this are in my programming assignment due-date planning.  All my due dates are “to be determined”.  Not a big deal but it can mess with the class progression and it does throw off the kid’s “flow”.

Automatic updates should never be the default.  They should not be weekly.

Techs all over the state are complaining about this feature of Windows 10.  Labs being useless while Windows 10 updates take over.

I like Windows 10.  I just wish Microsoft had written it right the first time so they do not have to keep updating it.  Or at least cut the updates to once a month.

The obvious solution is to have a WSUS server so the updates are not acquired by the client computers from the internet but from the WSUS server and the WSUS server is scheduled to hand out the updates at a convenient time, like midnight on Saturday.  Building a WSUS server is one of those little tasks I have not had the time to learn how to do.

Death of a Server

October 1, 2016

Tuesday I had a server die.  The hard drive was making a loud clicking noise which is a bad thing for hard drives.  (I had a student tear it apart just out of curiosity.  The read/write head had actually scratched the disk.)  It was not an important server; it was the student files server and most of the kids are on the cloud.  The box itself was an old Dell Optiplex 320 with a single drive running Windows Server 2008.  It was not really intended by Dell to run as long as it did, I figure about 6 years as a server without a break.  I thought I had a mirror drive in the box.  So much for thinking and not checking.  Originally I was not even going to replace the server but two teachers did use the server for students to turn in homework.  One of the teachers was the elementary tech teacher.  K-4 do not have Google accounts so this is how she collects their computer work.  For her this is an excellent solution so I had to replace the server.  Not a big deal box-wise.  I have a staff file server that is not used by many of the staff (the cloud again) so all I have to do is create a folder, share it and point the student’s domain policy at that folder with a drive mapping.  Piece of cake.  Yah, right.  I do this kind of stuff once in a blue moon.

The staff server is Server 2012.  Server 2012 has a slick process for mapping users to drives.  I tinker for a couple of hours.  Now I can do this mapping one student at a time by manually putting the folder address in their policy one at a time.  A real pain.  I continue to tinker with no luck.  I probably have some folder permission buggered up.  I tinker some more and finally resign myself to pasting the mapping into every student’s profile.  Bummer.  I am sitting there looking at this long list of names that I am going to have to do one at a time when I am struck by a moment of brilliance.  Can I highlight the kids and paste in a generic username and have it work?  Yup, I can.  Two minutes later I am done.

So here are some lessons learned.

  1. Mirror a spare drive in these non-multidrive servers.  I will check the staff server Monday.
  2. File permissions are an ugly mess when trying to learn them by trial and error. I need a class.
  3. I could have done the paste thing three hours earlier. Sometimes doing what you know how to do even if it looks tedious is better than trying something new that you do not know how to do.

I have been the school’s sole techie for 10 years and I am always amazed by how little I really know about the job.  There is always something like this coming up that takes me hours to figure out when there is a 5-minute solution if I knew what I was doing.  Every time I do something like this I learn new stuff but by the time I have to do I again I have forgotten what I learned.

I have had to learn this job by 100% on the job training but with all the headaches, stress from lack of knowledge, lack of time to learn the job properly and duct tape solutions due to lack of budget this job is still more fun than a box full of kittens.

Computer Programming: Free stuff is everywhere

September 27, 2016

October 20th I am giving a presentation at the annual Montana Educators Association conference.  The topic is “Computer Programming:  Free stuff is everywhere”.  (Originally I was going with “Computer Programming: Free shit is everywhere” but it simply did sound professional and at all costs I must sound professional.  I also do not think the organizers would have gone with that title.)  I usually do not get into doing presentations like this.  I have a tendency to get enthusiastic which means I start waving my arms, jumping around, speaking excitedly and overall looking like a stone-cold idiot.  But I could not resist.  The reason I am submitting myself to a demonstration of public stupidity is simple.  For some odd reason many Montana schools have decided teaching CS and/or programming is an expensive proposition and therefore not introducing it into their curriculum.  I, on the other hand, consider it the cheapest subject to teach.  My feeling is the only expense that falls on the budget is the cost of a teacher.  Admittedly this is not trivial, in fact just finding a teacher qualified (or if not qualified at least willing to learn) to teach CS/programming can be a challenge for schools, especially out here in the boonies of Montana.  The other expense they seem worried about is computers.  Are there high schools out there without a computer lab?  Maybe but not likely.  Do the kids have their own laptops?  Usually.  If a school does not have the hardware (available lab or shortage of student laptops) there are solutions.  Montana has a State recycle warehouse with all the tech stuff available for free.  Computers, laptops, monitors, keyboards, etc, etc.  The stuff is free.  No, it is not new but a 5-year-old computer works just fine for almost all programming applications.  I would assume most states have the same warehouse somewhere.

So I want to expound on why I consider CS/programming such a cheap subject to teach.  Since most schools think CS and programming are the same thing I will look primarily on programming assets.  This post is just the beginning of me organizing my thoughts so I can prepare something that will not reinforce the appearance that I am in idiot.

In the beginning there was the programming language.  How many free (and good) languages are there out there?  Let me count the ways.  No, I won’t, there are too many.  Here is a list of the ones I have used that are worth the trouble of using or free applications that might be worth learning.  Some of these are what I would consider suitable for an intro programming course.  Some are suitable for advanced courses.  ALL of these have free versions and have free or dirt cheap learning materials available somewhere.  If it isn’t free or really, really cheap it does not fit my budget.

Logo – Lots of them out there.  Beginning programming.

Scratch  (https://scratch.mit.edu/)  –  Beginning programming.  Designed for teaching.

Alice  (http://www.alice.org/index.php) – Beginning programming.  Designed for teaching.

Touch Develop  (https://www.touchdevelop.com) – Beginning to pretty advanced programming.  Designed for teaching.

Small Basic  (http://smallbasic.com/)  – Beginning programming.  Designed for teaching.

Kodu  (http://www.kodugamelab.com/)  – Beginning programming.  Designed for teaching.

Visual Studio Express  (https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx) Intermediate to professional programming.

Corona/Outlaw (https://coronalabs.com/ and http://outlawgametools.com/game-dev-product/outlaw-ide/) – Intermediate to professional programming.  Phone apps.

GameMaker  (http://www.yoyogames.com/gamemaker) – Beginning  to intermediate programming.  Strictly game authoring.

Python/Pyscripter (https://www.python.org/) Beginning to advanced programming.  Designed for teaching but can be used for professional work.

Java – Intermediate to advanced programming.

Unity or Unreal Engine (https://unity3d.com/  or https://www.unrealengine.com/what-is-unreal-engine-4) – Intermediate to advanced programming.  Game authoring.

MIT App Inventor  (http://appinventor.mit.edu/explore/) Beginning programming.  Designed for teaching.  Phone apps.

 

Again all of these have free versions and all of them have free tutorials or teaching materials.