Shop OBEX P1 Docs P2 Docs Learn Events
Teaching Robotics with PropGCC and SimpleIDE — Parallax Forums

Teaching Robotics with PropGCC and SimpleIDE

Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
edited 2014-01-20 19:30 in Propeller 1
In another thread I mentioned my experiences and preferences for teaching robotics with the ActivityBot and shared my criticism of GCC as the vehicle for doing that. It spawned a discussion that was off-topic for the thread in which it occurred, so I'm moving the relevant posts here.

-Phil
____________________________________
me wrote:
I was rather hoping [PropGCC] would die eventually under the weight of its own archaic complexity.
David Betz: "Not funny." mindrobots: "ouch!" Heater: "Outrageous. A bit rich coming from a Perl monger."
Wow. I seem to have struck some raw nerves with my attempt at humor. 'Sorry about that!

As some of you know by now, I'm teaching a once-a-week class with the ActivityBot using GCC and SimpleIDE. Despite the excellent curricular materials on learn.parallax.com, I feel very strongly that the students would be much further along in both general programming skills and robotics concepts if the curriculum had been designed around Spin with the Propeller Tool instead of C. But this isn't the thread for language comparisons, and I don't want to take it further OT with my comments.

BTW, Heater, I would never want to program the Prop in Perl. Sheesh!

Rick, any effort to cast light in the shadows is to be encouraged. I wish you success in your endeavor.

-Phil

Comments

  • Heater.Heater. Posts: 21,230
    edited 2014-01-19 12:55
    Phil.
    I feel very strongly that the students would be much further along in both general programming skills and robotics concepts if the curriculum had been designed around Spin with the Propeller Tool instead of C.
    I can see that this might well be true.

    There is a reason us young teenagers were introduced to the concepts of programming by means of BASIC. That's BASIC on a mainframe by the way not a C64.

    Such a system removes all the cruft and unintelligible boiler plate gibberish and gets you straight into what you want to do at the moment.

    The Prop and Spin and the Prop Tool have this property.

    The Arduino and it's IDE also has it.

    SimpleIDE and propgcc, as much as I love them, do not have that.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-19 13:16
    Despite the excellent curricular materials on learn.parallax.com, I feel very strongly that the students would be much further along in both general programming skills and robotics concepts if the curriculum had been designed around Spin with the Propeller Tool instead of C.
    Do you think it is the C language that is causing the trouble or is it the complexity of the tools we've assembled for PropGCC?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-01-19 13:55
    David Betz wrote:
    Do you think it is the C language that is causing the trouble or is it the complexity of the tools we've assembled for PropGCC?
    It's mostly the language itself. (It would be much, much worse if there were no SimpleIDE and the students had to deal with make files and the like.) I have found that progress is impeded daily by semicolons and curly braces. Prototypes and header files are another annoyance. And while (1) is just a kludge that Spin's simple repeat handles more intuitively. None of these things get in the way of the Spin programming experience, and students would be able to learn programming instead of wrestling with C's arcane syntactical and semantic requirements.

    As for SimpleIDE, one unnecessary speedbump is the lack of automatic Prop detection on the various available serial ports (
  • Heater.Heater. Posts: 21,230
    edited 2014-01-19 14:28
    David,
    Do you think it is the C language that is causing the trouble or is it the complexity of the tools we've assembled for PropGCC?
    It's both.


    When you want to teach somebody what programming is all about you might want to start with the idea that programs can do simple calculations. A good start would be:
    a = 1 + 3
    
    Of course in C you cannot do that you have to write:
    #include <stdio.h>
    int main (int argc, char* argv[])
    {
        int a; 
        a = 1 + 3
        printf ("%d\n", a);
    }
    
    You have lost your audience after the first three lines. Oh and there is a semicolon missing so it all fails even if they are persistent anyway.


    But it gets worse. You can't just type that in and have it produce a result. Oh no, you need a "project" and mess with directories, why for god sake? By this time your audience is back to playing Agree Birds.

    I'm sure us guys who have been immersed in this soup of weird symbols and syntax for years cannot see how blinding it is to a beginner.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-19 14:35
    It's mostly the language itself. (It would be much, much worse if there were no SimpleIDE and the students had to deal with make files and the like.) I have found that progress is impeded daily by semicolons and curly braces. Prototypes and header files are another annoyance. And while (1) is just a kludge that Spin's simple repeat handles more intuitively. None of these things get in the way of the Spin programming experience, and students would be able to learn programming instead of wrestling with C's arcane syntactical and semantic requirements.

    As for SimpleIDE, one unnecessary speedbump is the lack of automatic Prop detection on the various available serial ports (
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-19 15:47
    Heater. wrote: »
    David,

    It's both.


    When you want to teach somebody what programming is all about you might want to start with the idea that programs can do simple calculations. A good start would be:
    a = 1 + 3
    
    Of course in C you cannot do that you have to write:
    #include <stdio.h>
    int main (int argc, char* argv[])
    {
        int a; 
        a = 1 + 3
        printf ("%d\n", a);
    }
    
    You have lost your audience after the first three lines. Oh and there is a semicolon missing so it all fails even if they are persistent anyway.


    But it gets worse. You can't just type that in and have it produce a result. Oh no, you need a "project" and mess with directories, why for god sake? By this time your audience is back to playing Agree Birds.

    I'm sure us guys who have been immersed in this soup of weird symbols and syntax for years cannot see how blinding it is to a beginner.
    I'm not going to argue with this. I am not in love with C syntax myself although I've gotten used to it and now it seems normal. I suppose it might be difficult for beginners. However, the arcane Spin operators I would think would also be difficult for beginners. In any case, I don't know how you balance using a good language for teaching and teaching a language that might actually be useful in the real world. Maybe it would be best to use something like Python. I know it won't run on the Propeller and maybe not even on the Propeller 2 but you can certainly run it on relatively cheap ARM boards. Maybe that's the solution. You teach a language that is common in the professional community but that has a less arcane syntax than C. Teach using a RaspberryPi with Bill Henning's new Propeller PiPlate.
  • jmgjmg Posts: 15,173
    edited 2014-01-19 17:48
    It's mostly the language itself. (It would be much, much worse if there were no SimpleIDE and the students had to deal with make files and the like.) I have found that progress is impeded daily by semicolons and curly braces.

    To help with C's arcane syntactical and semantic requirements, there are some new 'Smarter Editors' showing in some IDEs.

    This effectively adds a simple C parser into the editor, and it gives yellow alerts in the Left editor column.

    examples : I delete a trailing semi-colon, the hover on the yellow [?] that appears, says "missing semicolon"

    If I edit to this
    if (VarName = 0)
    the yellow alert now says "possible assignment in condition (VarName = 0)", fixing as if (VarName == 0) removes alert.

    If I remove or add a {, or ), it says 'Syntax error', and a cursor after any {} (), highlights the matching brace.

    All of this greatly helps novices, whilst not strictly fixing the arcane syntactical and semantic requirements, it makes them more tolerable.
  • jazzedjazzed Posts: 11,803
    edited 2014-01-19 21:09
    Attention to detail is a foundation of success. Stop complaining and teach it.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-01-19 21:22
    jazzed wrote:
    Attention to detail is a foundation of success. Stop complaining and teach it.
    That's such a load of Smile, Steve! The foundation of effective pedagogy is incremental success. To attain this you have ot remove barriers to learning, not erect them. I have one hour a week to keep these kids interested long enough to learn something useful. And you want me to spend that time diagramming sentences? Give me a break!

    -Phil
  • jazzedjazzed Posts: 11,803
    edited 2014-01-19 21:31
    Phil, I take it then that you never learned attention to detail.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-01-19 22:16
    jazzed wrote:
    Phil, I take it then that you never learned attention to detail.
    That's a ridiculous statement, and you know it! Of course, details are important, but that's not the point. The point is that if the minute details get in the way of teaching and learning the substance of a subject, then something is wrong with the whole approach. What you're quoting is from the Charles Dickens School of Learning. But we're not in Victorian England, and "Please, sir, may I have another?" just doesn't have a place in today's educational environment. My thesis is that Spin is much more suited to that environment than C is where programming the Propeller is concerned, assuming the objective is to teach general programming concepts as efficiently as possible and not just a specific language.

    -Phil
  • W9GFOW9GFO Posts: 4,010
    edited 2014-01-19 22:20
    Speaking of "attention to detail", have you seen that movie "G r a v i t y"?

    First time I heard "attention to detail" was in boot camp. It suited me just fine. It's the way the world should be. I think most people do not care about attention to detail, the lack of it's practice is evident everywhere - commercials, movies, driving habits, product manuals, dentistry... you name it. It should be taught in schools, and I guess it is sometimes alongside things like math but we would do well to have it be its own subject. If everyone learned "attention to detail" all our lives would be much different than they are today - movies would be better for one thing...

    Attention to detail is required in all programming, it is required in Spin too.
  • LevLev Posts: 182
    edited 2014-01-20 06:06
    The appropriate level of detail depends on the educational goals of the class, the age level, the schedule, prior skills of the students, and many other factors. Though I don't know the details, I think Phil has a good point. An elective class for students with a general interest in programming and no prior programming experience should be different than a class for CS or engineering class for majors, for example. In any case, a tight schedule forces a teacher to pick and choose topics, and where to place emphasis. It is often said that the hardest thing about teaching is deciding what not to do.
    I often give my beginning physics students program templates that already include the burdensome details so that they can focus on isolated sections of code, for example a loop structure or a series of physics equations. After they experience the satisfaction of a working program, they are more interested in learning the details. It is like fishing, first you need an attractive lure to get their attention.
  • ctwardellctwardell Posts: 1,716
    edited 2014-01-20 06:28
    Questions:

    What is the age group for this class?

    Can some form of LINT functionality be added to SimpleIDE?

    Comments:

    Attention to detail is important, however you have to understand the details before you can pay attention to them.

    Since the educators in this case and many others want 'C' this needs to be about how to best teach 'C' not to throw rocks at it. In other words "it is what it is", so how do we best deal with it.

    A road block has been identified with the issue of the "build failed" error in SimpleIDE when the real issue is the prop is not on the expected port. Can this be easily fixed?

    C.W.
  • Heater.Heater. Posts: 21,230
    edited 2014-01-20 06:52
    "Attention to detail"

    Which details?

    At the point you start off attempting to kindle some curiosity and enthusiasm for programming to a rank beginner, who may be 10 years old or 60, The details you want them to focus on might be:

    a = 3 + 2

    Anything else is a confusing mind-numbing diversion. Trees in front of the forest. Information overload. That will kill that curiosity and enthusiasm stone dead in seconds.

    Attention to detail is important. Especially so in mathematics for example but there we start with 1,2,3...Not differential calculus.
    Jazzed has forgotten he was ever ignorant of such things.

    David,
    I don't know how you balance using a good language for teaching and teaching a language that might actually be useful in the real world.
    Python would be a good example. Very easy to kick off with but a very powerful languages used by experts.

    JavaScript would be another.

    See Espruino and MicroPython projects.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-20 07:00
    Heater. wrote: »
    "Attention to detail"

    Which details?

    At the point you start off attempting to kindle some curiosity and enthusiasm for programming to a rank beginner, who may be 10 years old or 60, The deatils you want them to focus on might be:

    a = 3 + 2

    Anything else is a confusing mind-numbing diversion. Trees in front of the forest. Information overload. That will kill that curiosity and enthusiasm stone dead in seconds.

    Attention to detail is important. Especially so in mathematics for example but there we start with 1,2,3...Not differential calculus.
    Jazzed has forgotten he was ever ignorant of such things.

    David,

    Python would be a good example. Very easy to kick off with but a very powerful languages used by experts.

    JavaScript would be another.

    See Espruino and MicroPython projects.
    One reason that I think Python would be a good choice is that it is interactive. You can type exactly the expression you mentioned above at a prompt without any declarations or prototypes or anything. You can then type "print a" to see that the assignment actually did what you expected. This also seems to be true of the Espruino version of JavaScript so that might be the best choice for teaching robotics since it will run on a small MCU board that could be used to control a robot. Neither C nor Spin have this ability so there will always be a bunch of scaffolding you have to construct before you can actually run a program. Spin is slightly better in that regard because it eliminates the need for function prototypes and header files but it is still essentially a batch language, not interactive. Moving from C to Spin doesn't really solve the biggest problem. You can't just "play with your program" by typing simple commands at a prompt.
  • Heater.Heater. Posts: 21,230
    edited 2014-01-20 07:20
    You can do the same interaction with JavaScript. Just hit Ctrl-Shift-J in a Chrome browser and start typing JS expressions as above. I'm sure FireFox and other browsers have similar REPLs somewhere.

    Then there is node.js. Just type "node" at the command line and start talking to it.

    And the Espruino of course.

    Spin makes things a lot easier than C for that quick start I believe. What with removing the need for so many brackets and braces and the lack of header files. Also typing into the PropTool or similar and hitting "run" is pretty quick interaction.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-20 07:58
    Heater. wrote: »
    You can do the same interaction with JavaScript. Just hit Ctrl-Shift-J in a Chrome browser and start typing JS expressions as above. I'm sure FireFox and other browsers have similar REPLs somewhere.

    Then there is node.js. Just type "node" at the command line and start talking to it.

    And the Espruino of course.

    Spin makes things a lot easier than C for that quick start I believe. What with removing the need for so many brackets and braces and the lack of header files. Also typing into the PropTool or similar and hitting "run" is pretty quick interaction.
    Yes but even with Spin you still have to wrap your statements in a function definition if nothing else. Anyway, my understanding is that Spin was rejected because it is not a "standard language". The reason for proposing C or Python or JavaScript is that they are standard languages. If you remove the "standard language" requirement there may be many other languages that could be considered.
  • Heater.Heater. Posts: 21,230
    edited 2014-01-20 09:04
    So Spin is out because it's not a "standard" language.
    C is out because it's too much for rank beginners.
    One of us had better get down to getting MicroPython or JS running. I imagine only on the P2 though.

    On the other hand the Aduino has demonstrated that rank beginners can get on very well with C++ if you hide the grungy boiler plate of headers, main() etc. And carefully don't mention all the shitty parts of the language in the tutorials. Oh, and don't even tell them it is C++!
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-20 09:08
    Heater. wrote: »
    So Spin is out because it's not a "standard" language.
    C is out because it's too much for rank beginners.
    One of us had better get down to getting MicroPython or JS running. I imagine only on the P2 though.

    On the other hand the Aduino has demonstrated that rank beginners can get on very well with C++ if you hide the grungy boiler plate of headers, main() etc. And carefully don't mention all the shitty parts of the language in the tutorials. Oh, and don't even tell them it is C++!
    Yes, using the Arduino IDE with PropGCC might satisfy the requirements of making C/C++ simple enough for beginners. However, you still have to worry about those pesky semi-colons and braces. I guess you have to worry about those in JavaScript as well. Maybe MicroPython is the only answer! :-)
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-20 09:12
    Actually, the main advantage that the Arduino IDE has over SimpleIDE is their C preprocessor that eliminates the need for prototypes and some includes. I wonder if that preprocessor could be made to work with SimpleIDE? That might be the best of both worlds because SimpleIDE is certainly a nicer interface than the Arduino IDE.
  • dgatelydgately Posts: 1,630
    edited 2014-01-20 15:39
    About editors that see errors and offer help...

    Apple's XCode editor 'sees' simple editing issues dependent on the source language you are editing and recommends a fix. Actually, it offers to fix the problem for you. Something like that would really help new coders to learn those "nitty" details of more complex or should I say, "picky" languages (C, C++, Objective-C, C#, JavaScript, etc.).

    Here's what XCode came up with when I left off the semicolon at the end of a statement:

    editThis.png


    Personally, I really liked Spin when I came over to the Propeller from Arduino and Desktop App development. The language was simple and hard rules like indenting to create code blocks actually helped in writing code that is easy to read. I think back to my days of learning BASIC and I remember having to force myself to use lots of REM statements to document just so I would understand it at a later date.

    An IDE like an updated SimpleIDE that is built for Spin and C development (who knows, maybe another language once Prop II is out) and has features that allow new users as well as experienced users to get the most from their programming time, would be excellent.

    Phil mentioned that SimpleIDE's Project view got in the way of new students learning. Well, SimpleIDE offers a "Simple View" that hides all the details of projects. Enhancing Simple View to provide more 'helps' for new coders, some templates for Spin and C, could give an experience similar to Arduino's IDE. I personally, find the Arduino IDE less than helpful while writing code, but it has gotten lots of non-technical types and young people writing code.

    Why not just make a list of features for an enhanced SimpeIDE? Then, Parallax may sanction that as a future direction (if they have not already done so :innocent: ).


    dgately
    918 x 296 - 73K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-01-20 16:55
    dgately wrote:
    Phil mentioned that SimpleIDE's Project view got in the way of new students learning. Well, SimpleIDE offers a "Simple View" that hides all the details of projects.
    The students I have do use Simple View. And I actually prefer it myself for editing, since the room available for source lines is longer.

    Back to braces, one thing I've noticed is that the kids are very sloppy with indentation and brace placement.* I let them get by with it, too, since there's so little time in one class period to get any real work done that style becomes a less than tertiary concern. With a language like Spin or Python, though, style is enforced as part of the syntax, which I see as a distinct advantage.

    -Phil

    * To be honest, the example code in learn.parallax.com uses a brace style that's contrary to what I'm used to in Perl. I like the opening brace on the same line as its antecedent, and compact constructs like } else {. So I'm reluctant to tell the kids that one style is better than another, since it's pretty much a matter of taste. Besides, they're writing short, throw-away programs that don't last longer than one class period. -P.
  • rod1963rod1963 Posts: 752
    edited 2014-01-20 19:30
    The Mbed C/C++ compiler for the ARM is also doing well with introducing C++ by hiding a lot details and drudge work to hobbyists and making the ARM accessible as well.

    It's a nice approach, same the with the Arduino and it's variants(Enegeria and Pinguino).
Sign In or Register to comment.