"In the world ye shall have tribulation: but be of good cheer; I have overcome the world." –John 16:33

Tag: C/C++

How to teach computer programming to kids (Part 9) A suggested curriculum

Day 617 of 1000

This is the ninth in a series of posts on how we taught our children to program, what we did wrong and how we think we could have done better.  You can see the introductory post and index to the series by clicking here.

[Previous post]

This post describes how I think I would teach an eleven year old kid how to program.  I explained the many things we did wrong and the few things we did right in teaching our kids how to program when they were young In the previous posts in this series.  We really did not do so badly with our son.  He is a good programmer with a solid knowledge of the fundamentals of object oriented programming in C#, C/C++, and Python.  His college level Introduction to Java class was a trivial exercise for him.  We did horribly with our daughter.  So much so that she struggled mightily with the same Introduction to Java class at which our son had excelled.

We have a good (certainly not perfect, but good) track record teaching our kids things like reading, math, art, typing, and all kinds of other stuff, so I have tried to think about what I did wrong and how I might do it if I had it to do over.  I think the main reason we did not do so well is that we did not see programming as an essential skill.  We were wrong.  All STEM majors need to know how to program and that knowledge is a huge advantage to kids who enter a STEM degree in the University.

What language should you chose?

So, what could we have done to teach our kids programming at an early age?  There are a lot of small concepts a new programmer has to learn before any attempt is possible to learn the big picture programming ideas, particularly object oriented programming.  There are lots of books that explain these details quite well.  A language that handles some of the minutiae for the new programmer so they can learn these small concepts one at a time is a big advantage.  Languages like C#, Python, and Java all qualify.  C/C++ does not for reasons #3 and #4. There are good reasons for selecting one of these languages:

  1. These are serious languages for serious programmers that can perform anything from small embedded applications for single board computers to game programs running on personal computers to full-blown, big data, internet enabled monster programs running on “big iron”.
  2. They have large sets of libraries that the new programmer can use without a lot of knowledge about what is going on under the hood.
  3. Garbage collection (a technical detail we don’t need to go into here) is managed by the language so the new programmer can concentrate on learning the small concepts without the program breaking for mystifying reasons.
  4. There are very good Integrated Development Environments (IDE) for all of these options.  An IDE is a program that is used to write programs.  It has an editor, a compiler, a linker–everything need to write, debug, and run a program in an easy to use environment that usually has a hint systems (intelli-sense) for computer commands in case the programmer forgets what he should type next.
  5. There is a TON of documentation, tutorials, examples, and books on the internet and in print for all these languages.

We started in C# because it meets all the criteria above, I had good knowledge of the language, and we found what looked like a good tutorial book on C# that featured something of interest to my son.  That was a great reason to go that direction at the time.  I think if I had to do it over, I might start with Python.  There is no particular reason that Python would be better than C# or Java, but I am aware of a number of cool, hobby projects written in Python and I would like to get a little deeper knowledge of Python myself.

What book should you chose?

Programming the Raspberry Pi, Getting Started with PythonThese days, it is possible to get all the information required to program online.  I have learned languages that way (Python and R).  Nevertheless, for a sit down class with an 11 or 12 year old kid, it is nice to have a book to follow.  In addition to the book we used to get started (Beginning C# Programming),  I have been looking at a book with great reviews titled Programming the Raspberry Pi, Getting Started with Python.  The thing that is great about this book is that, if you already have a USB cable and a reasonably capable PC, you can be complete set up with an embedded computer to write robotic, internet, game, and other kinds of programming for less than $100.  Here is the blurb from Amazon for the book, a Rasberry Pi embedded computer, and the Raspberry Pi user manual:

Rasberry Pi + Manual + Python book

The reason both the books are good is that they start from ground zero, they feature good starting languages as defined above, and they have project goals that are likely to interest kids of the age of 11 or 12.  The Raspberry Pi is particularly good because it features a chunk of hardware to which the kids can hook up other stuff and/or connect to the internet.  These are just examples, but the concepts behind both these books are great.

How should I do the teaching?

This is an especially good question if you, yourself know nothing about programming.  The beauty of the above setup is that the books walk you through the set up of the computer, the download of the language and IDE, etc.  They give button push by button push instructions.  If you do not know anything about programming, this will teach you.  As for your kid, it has been my experience that at 11 or 12, kids generally love to do stuff one-on-one with their parents, even if they sometimes do not admit it.  The one-on-one approach is the right way to go.  Here were my rules for a structured program like this:

  • Go by the book.  You might think you have a better idea.  You might ACTUALLY have a better idea, but if you stick to the book you will be assured you and your kid have all the materials to go on to the next chapter.
  • Sit down with your kid for 20-30 minutes per day, at least four days per week.  Be present with him the whole time, but quit after the alloted time so you want to come back for more.
  • Let him do ALL the reading.  Have him read every word, aloud.  Talk about it when you or he don’t get it.  Look up explanations on the Internet when needed.
  • Sit on your hands.  Let your kid hold the book and turn the pages.  Let you kid plug in the computer. Let your kid download and install the programs and software.  Let your kid do ALL the typing.

That is all I have.  I wish I would have done it that way.

How to teach computer programming to kids (Part 2) Working with Linux – Compiling and Linking

Day 601 of 1000

This is the second in a series of posts on how we taught our children to program, what we did wrong and how we think we could have done better.  You can see the introductory post and index to the series by clicking here.

[Previous post]
[Next post]

We think it was about 2005 when Christian was ten years old or so that he really took an interest in how software works on a computer.  I am not talking about how to use software on a computer.  I am talking about how it actually works.  We had an old Dell Desktop (I forget the model) with Ubuntu Linux installed on it.  All Christian wanted to do at first was install some games and some drawing and rendering programs.  The way you did that with Ubuntu is through the use of a GUI front-end program called Synaptic that managed program installation, updating, deleting, etc. using a program tool called APT (Advanced Packaging Tool).

He got pretty good at that, but the computer was so limited in its capabilities and resources he would often get stuck.  This led him to the use of Google to find answers to his questions about how to get unstuck. The problem was that he often stayed stuck because there were no good answers on the internet, even after a thorough search.  The next step, then, was to ask experts on forums like Ubuntu Fourms.  The answers often came in the form of a command line (non-GUI) process where he had to open up a console to get a command prompt so he could follow the procedures he was given.  Little by little, he got proficient at using the Linux command line to run APT and other utilities, getting help from man pages, and learning Linux’s basic directory structure.

Next, he started to run into programs that were not set up for installation via APT, so he learned how to install programs from the source code.  The way it works is that a program’s source code, usually C/C++ is downloaded from the internet.  It is set up for the computer on which it will be installed and customize for the needs of the user by running a program called configure.  Then a program called make is run to compile and link the program which creates the binaries (the actual file(s) that will run the program).  Finally, make is run again, but with the word install after it so that the program will be moved to the correct folder in the Linux file system so that the user will know where and how to start the program and the program will know the location of other files it needs to run properly.

The set of steps listed in the previous paragraph–configure, make, make install–is the normal procedure used to take programs written in C/C++ as text files, turn them into programs that will run on a computer, put the files in the correct folder on the disk drive, and assure all additional files required to run the program are in the right place.  Sometimes the names of these steps change depending on the computer, operating system, and other factors, but the process is essentially the same.  The problem is that the configure, make, make install process hides compiliation and linking from the user.  That is a good thing most of the time, but a person who wants to learn how to program needs to know how to compile and link a program, not just follow the cookbook configure, make, make install process.

Fortunately for Christian, the configure, make, make install process, for some fairly technical reasons, did not allow him to control the installation of the programs he wanted to run in the way he wanted to run them.  Specifically because of that, he started to read and learn about the compiling and linking process.  For some programs, there are heavily documented, step-by-step procedures to walk through that process.  This helped him understand how a program called a compiler takes a text file that holds a C/C++ program and converts it into a binary file and how a second program called a linker takes that binary file and links it to other program files that it needs to run properly.

It is not possible to program without knowledge about how to perform compiling and linking.  This can be hidden from the programmer in something called an Integrated Development Environment (IDE) which we will talk about later, but it is best to get started just the way Christian got started, learning the command line usage of the compiler and linker because this gives a much better understanding of the process needed to test and run a hand-written computer program.

All of the above happened under my radar.  At first he did this to get games and drawing programs running, but eventually, he just wanted to learn more about how Linux and the programming process worked.  All I really did in this process was provide a ten year old boy an old, piece of trash computer that had no programs on it that interested him.  He did the rest.  I am not sure how I would have taught this to him in a structured way, but I will take a stab at explaining how that could be done toward the end of this series of posts.

Computer programming for kids – a new series of posts

Day 583 of 1000

It is my daughter, Kelly’s, birthday today.  She is now a 19 year old Statistics major at North Carolina State University and is taking her first two formal programming classes, Statistical programming with SAS and Java.  She has also programmed with the R statistical programming language.  She enjoys programming a great deal, but is a little frustrated with her Java class.  Kelly is not frustrated with the material; she enjoys that.  She is frustrated because I taught a lot of programming to Christian, but virtually none to Kelly.

She said, “Dad, why did you teach Christian how to program and not me?”

I said, “Because you enjoyed other stuff like art and crafts and Christian wanted to know how to program his Palm Pilot.”

She said, “You should have taught me, too.  I need to know how to program now and I am having to learn it from scratch.”

“You really have to have something you want to do with programming or it is really boring,” I replied.

“You made us do Mavis Beacon Typing 15 minutes every day for two years and we didn’t have any real use for it until years later.  It was really boaring at the time, but got A LOT out of being able to type faster and better than everyone else.  We are really glad you made us do that.”

All this was true.  I think I failed Kelly in this.  Christian learned how to program on his own, but I bought him the learning materials, made computers available to him, and vmade a program of study that was both systematic and and integrated part of his homeschool curricula.  The reason we did all this for Christian was because he had something he wanted to accomplish. I should have thought to teach them both how to program whether they wanted to or not.  The program we put together for Chrisian has given him a huge leg up both in class and with work opportunities.  Any student who plans to get a hard (STEM) degree, would benefit from such a study program.  I am just sorry I did not do this for Kelly.

I have decided that, when I finish my current series on Why not skip high school?, I will write a series on how we taught Christian to program.  I will link to that series from this post as soon as it is started.

Powered by WordPress & Theme by Anders Norén