Advice for teaching programming to an adult (with Arduino)

Hello all,

have been around some time here but haven’t participated in discussion that much because most topics are pretty advanced and, with my limited knowledge of Linux, I didn’t think I could add anything to the conversations.
But, because I didn’t know where to ask else and I really trust this community and their expertise, I have one question which is only remotely connected to Linux, but rather to computing in general: What is your advice / experience in teaching programming to adults (preferably in connection with the Arduino environment, or, broader, the basic, standing concepts in C-like languages) and do you have any tips for anyone in this situation?

Let me explain where I am coming from. Recently, a friend of mine and I started to think about doing some microcontroller coding projects with Arduino, with the intent to get some practical skills to apply them to larger projects (like building a self-driving mini car etc.). I myself have somewhat experience in coding, as I was pretty engaged in school and wrote a simple 3D physics engine in Java in my last school year, but I am not really a programmer, most code I write is very messy, and even though I’m somewhat interested in API design (mostly through reading the book Effective Java) and different programming paradigms as well as the formal basis of programming language (mostly through YouTube videos and the experience of reading The Little Schemer, which introduced me to the concept of functional languages; for me, at the time, a completely novel way of thinking about programming), I’m often only interested in getting the job done. In comparison, my friend, even though he had experienced programming in school, he suffered from a bad teacher and wasn’t really that inclined to go further down into that rabbit hole - until recently, when we started to build things with the Arduino and really have just a lot of fun brainstorming cool new projects to learn and tinker with; so I tried to teach him the basics of programming through practical appliance on the Arduino.
But I personally feel that I’m not that good of a teacher, because

  1. some programming concepts have been known to me for such a long time that I don’t know how to explain them to a beginner or explain the limitations of them
  2. I don’t know enough about the underlying structures of programming languages, even though I’m aware of the basic concept of compilers and bytecode etc. I don’t know in detail e.g. how memory allocations work etc. which - I think - are important to explain the limitations of a language construct which I take for granted, but are nonetheless confusing and upsetting to a beginner
  3. I don’t know which concepts to introduce in which order, right now I’m introducing concepts “on the way”, when I think they are in particular useful in our current problem. But this means that I’m artificially limiting the things we can do with the programming language, and also we are writing a lot of messy code which is just not well-structured (e.g. we wrote a program to send messages in morse code with a diode which could be easily programmed, but because he only knew the concept of functions and variables we wrote for every letter a function which resulted in lengthy code instead of defining some kind of mapping for every letter which could be automatically resolved - which, I think, would’ve been the more elegant and concise solution, but I didn’t want to overwhelm my buddy)
  4. I always had trouble explaining things to other people, even though I try to use metaphors etc. in most cases I fail just utterly to describe the things in a concise and precise way, and sometimes even my metaphors doesn’t work out at all and foster misconceptions.
    For 2. and 4. I have an example: I tried to explain the concept of a variable in a practical, high-level sense; and used the metaphor of a container with a name to illustrate the concept (as something which you always know how to designate and has some contents in it which can be easily changed). He thought about the concept further and asked whether there would be a way to define a variable which has, as he called it, multiple layers (as there could be in a container) which are automatically “scrolled through” every time the variable is retrieved; basically a self-changing variable following some convention in the changes. I tried to explain that variables only provide very basic, non-interactive functionality (even though I’m not entirely sure whether that’s always true, as I think in functional languages a variable can be assigned to an interactive function? And in OOP you have, of course, only objects which are often interactive. But here comes again my glaring lack of knowledge; at least I’m pretty certain that variables in the Arduino language are limited to their basic functionality), and tried to cram my very limited knowledge of memory allocation out of my mind to explain that they’re basically just a pointer to some section in memory; only further confusing my friend who doesn’t have much knowledge of the inner workings of a computer. Regarding types, I also had problems explaining the concept, the same goes for functions (especially as I tried to draw parallels to the concepts of mathematical functions for functions with return value, but that doesn’t make a lot of sense when applied to functions with no return values?) and so forth and so on.

So, my teaching method is basically a big glaring inconsistent mess of practical application and bad metaphors for theoretical concepts which really hinders our ability to advance. It is a revealing experience for me because you begin to think about old concepts and their limitations in a new light; but also a frustrating experience because in most cases I don’t have satisfactory answers for the questions of my buddy (and an experience that is, once again, proving that only the best are really able to teach beginners well). I tried researching in the internet a bit, but most material is not trying to teach you teaching programming but rather to teach you the concepts of programming itself; and the rest is primarily aimed at school teachers teaching children. I have found some pages which show up relatively high in the DuckDuckGo search, this site which gives me a basic idea of how to approach teaching, but I have trouble applying it to the specific situations, this article which affirms my supposition that it’s more important to teach how and why the code works rather than how it looks, but again, I have trouble explaining these concepts in the first place, so what should I do?

I’m pretty puzzled right know to what to do next and how to continue teaching him, so I thought I would ask whether you had any personal experiences in teaching programming to adults and whether you have any tips, maybe even specific ones for the Arduino platform.

Thank you for reading through this lengthy post :wink: and regards.

Edit: Just wanted to say, I’m not a native speaker. Please, if you find any errors, tell me and I’ll correct them.

My 2 cents… you generally never aim for elegance in the prototype phase and it sounds like you guys are mostly prototyping. It’s far more critical to achieve successes and as you learn more and come back to improve old code the elegance will grow naturally.

I’d have him tell you what he wants to achieve and if it’s too advanced break it up into bite sized generic components that when combined will achieve that goal. If any of those are too big break them down again.

If he’s motivated he’ll figure it out with our without you. Don’t worry too much about the details, just get him short examples he can chew on that put out results.

C/C++ is also just a really tough language to start someone on. You might consider using a device that supports Python, JavaScript or similar till he’s more comfortable with how to think like a programmer.

1 Like

Hey, thanks for your answer. Yes, you are correct, right now we are only prototyping to try out ideas and then expand on one thing. I think I’ll try out your suggestion, to break every component down so that it gets just much more accessible.
Regarding C/C++ on Arduino: I think I didn’t express myself clearly. As far as I know, the default Arduino development environment (which we use right now, we aren’t delving into the realm of compiling our own C code yet which is something I am myself afraid of) is based on a language called Processing which is C-like in its syntax but technically designed as a scripting language; even though the ADE (Arduino Development Environment) compiles it to native bytecode for the specific processor . So I thought it was a somewhat good starting point, but I think your advice of starting out with Python or JavaScript may be a better idea, as they’re a little bit easier to get started with; at least I’ve got that feeling. Thank you for your post, I’ll try it and report back :slight_smile:
Edit: Couldn’t edit my original post anymore, so I removed the mention of the edit here. I would’ve liked to delete the reference to C-like languages because, even though the Language of the ADE has a C-like syntax, it has other than that not much in common with C. Other than that, I just wanted to say that the original post (from 200823) was written pretty fast and I was tired, so it reads a little bit rushed. I am sorry for that.

JavaScript shares a lot of the same syntax as C which can aid transition but Python tends to be better represented in the maker space. I don’t do enough in that area to make a recommendation sadly :/.

The forum has some weird rules on edit timing, possibly related to how established the account is. Just copy/paste the whole thing into a PM to me, edit as you wish and i’ll replace it. Always happy to make sure people’s posts are what they intended.

1 Like

You may also want to check this out for learning Javascript/Python, showed up in a quick forum search.

Learn To Code While Playing Games! CodeCombat For Python & JavaScript

Yes I think we’ll try maybe some Python. My buddy already learned a little bit Python in school, so it seems like a good / better choice than Processing. Got my Raspberry Pi today, I think I’ll try to get a Python interpreter running on it and try to control the GPIO pins.
Oh thanks for the offer. I think I’ll try to read through the first post again tomorrow, when I have more time and a clear mind; and make some revisions.

Looks cool for getting used to the syntax and staying on the ball (because of the gamifications). I think we’ll try it out as a supplement.

A little update: Haven’t got much time together to try out Python on the Raspberry Pi, but we decided to ditch Arduino (for now) and play a little bit with Python.
And a correction: I’m sorry, I made a mistake. Next time I should educate myself better before I write something: Of course, as Ulfnic said, is the language used by the ADE not a scripting language, it is C / C++ with some library and compiler extensions to provide an easy access (look at Arduino - Wikipedia for further information), so really not that good for starting out with programming.