Thoughts On Lego Mindstorms Programming

I’ve had the privilege to be a First Lego League (FLL) coach for the past two years.  It’s a very rewarding experience as I am amazed at the hard work and awesome ideas that these kids put into the research and their presentations.

The FLL competition each year revolves around a main theme.  This year it was called Food Factor and was all about keeping food safe.  The competition has three areas of emphasis, the Research (identifying and providing solutions to problems), Core Values (team participation, enthusiasm, gratious professionalism), and the robot (design and programming).  This is a very brief overview but you get the point.

FLL is for kids 9 to 14 years old and this year my team consisted of 10 kids (double the team size from last year) with two sixth graders, two fifth graders, a fourth grader, and five 3rd graders with seven of the ten being brand new to the program.  The ‘hook’ for most of the kids is the Lego Mindstorms robot and at the table competition challenges are made from Lego’s.  It’s brilliant because what kid doesn’t like playing with Lego’s?

In reality, though, there’s after building the field components there’s not a lot of Lego building.  There’s *some* with the robot but once you build it you really don’t want to mess with it much.  The robot is really about learning how to program and that’s where my big beef comes in.

After having used the Lego Mindstorms graphical programming environment for a couple of years for my First Lego League team I decided that it teaches them little to nothing about programming.  The graphical programming environment seems easy but in reality the kids find it frustrating and once you get past simple programs it quickly gets confusing.  There are ways around these limitations but I feel it in no way teaches the kids about good programming principles.

The IDE uses ‘blocks’ to describe what’s going on.  But, because the display doesn’t show the properties you are constantly having to click on blocks to see what is going on with that block.  So the graphical environment is NOT self documenting.

The left to right programming environment isn’t like most other languages.  I don’t know if this is a spurious argument or not but I find the left-to-right paradigm unsettling.  I spent years doing PLC programming in my electrical engineering days and I found it easy to describe how logic ‘fell through’ to the next level.  This language was used by a lot of plant electricians and a lot were not the ‘programmer type’ if you get my meaning.  All programming languages I’ve used professionally are text based vertical (top to bottom).  I feel the kids are not learning much that’s helpful when they get to a ‘real’ language.

You can add comments to the code which is kind of nice.  But, they are location specific meaning that if I added a comment near the 3rd block from the left and then added two new blocks before the 3rd one the comment is now out of place.  What I’ve found is that the kids won’t use comments.  No one likes documenting their code but because the IDE works against them they learn not to use it.

Variables are almost an afterthought in this development environment.  They are hard enough to use that it’s considered an ‘advanced’ technique?  Really!?  What programming language doesn’t make variables easy?  Another major failing in my opinion.

Now I don’t know what, exactly, I’d do differently, but I’m looking into it.  I’m looking at creating a set of Mindstorms NXT classes using Real Studio.  This might involve creating a base set of classes to allow Real Studio developers to control the robot just like the Mindstorms software.

Besides using standard REALbasic classes (and dot notation) I’d love to create a simplified interface that would be easy for beginners to accomplish some complex things.  I’ve batted the idea around of something like Mac OS X Automator.  It’s pretty linear, self documenting and graphical.  I don’t know how I’d handle loops but it has to be better than what the Mindstorms software is doing.

So I’ve done a little research and it looks like Real Studio can at least *see* the NXT using the MonkeyBread Software USB classes. Does anyone have any experience/insight in this area? I can start from scratch but I’d love to talk to someone that’s a Subject Matter Expert (SME) if I could.

For what it’s worth, there is a very old project that connected to the older RCX but not the newer NXT. Unfortunately, it was written using encrypted modules so it’s not possible to review and update the code for the NXT.

So if you have any experience in this area, please contact me and we’ll collaborate if possible.