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

Tag: Programming

Wt programming

I spent most of this last weekend writing a web program with a new (to me) set of C++ libraries named Wt (pronounced witty, they say, but I am going to call it double-u tee–like calling Qt cute, it is just a bridge too far). Wittiness aside, after making my way up a relatively steep learning curve, I am very, very impressed. It is open source software that I am currently helping some friends investigate. I has a commercial license for commercial products so I hope to be able to buy that someday soon–or better yet, get it bought for me. I might try to put a thing or two up on this website as I figure it out.

Betty Blonde #439 – 03/23/2010
Betty Blonde #439
Click here or on the image to see full size strip.

How to teach computer programming to kids (Part 4) C#

Day 605 of 1000

This is the fourth 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]

Beginning C# Game ProgrammingAt the beginning of the school year, just before Christian turned 11, we decided it might be a good thing for Christian to learn a object-oriented, non-garbage collected language with a lot of libraries and support.  The three obvious choices were Python, C#, and Java.  If I had to do it again, I probably would hanve started Christian with Python or Java, but I was doing some work in C# on Windows for my job at the time and was playing with Mono (a cross-platform C# implementation).

I wanted Christian to work toward the ability to program something in which he was interested so when I found Beginning C# Game Programming, it seemed a good fit.  The first few chapters explained the concepts of object oriented programming and the C# programming language.  Visual Studio Express, Microsoft’s Integrated Development Environment (IDE) for learners and hobbyists had come out not too long before this, so I spent a couple of hours on a Saturday downloading the program with Christian and showing the fundamentals of how to write, build, and run a “Hello, World!” program.

Next, as part of Christian’s daily homeschool plan, I assigned him to work on C# for fifteen minutes per day.  I wish I could say I assigned the work as part of a rigorous, well-thought plan to teach Christian to program, but the reality is that I assigned it to him because he was excited about learning to program.  I was more concerned that he focus on Literature, Writing, Math, and Science than programming.  We spent a lot more time on those core materials than his programming efforts.

The reality is that all I really did in terms of “teaching” him anything about programming (and I use the word “teaching” very loosely here), is review where he said he was in the book, quiz him a little bit about the concepts in that part of the book, look at how his program ran, and give him a few hints about coding style.  He was on his own with this.  The amazing thing is that he came away with quite a good understanding of Classes, Objects, Encapsulation, Inheritance, Polymorphism, and the concepts of Object Oriented Programming, as well as a pretty good knowledge of how to make things happen in a C# program.

Christian followed this program for about five months to get through the first four or five of chapters of the book.  The reason we stopped and moved on to something else is because Christian’s excitement diminished after about four months.  After that, we stopped programming for awhile so Christian could work on other computing projects.  It was a great exercise that was just long enough to keep a 11 year old kid interested.  Again, if I had to do it over, I would do it differently and will explain how I might have done it in one or more later posts.

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.

How to teach computer programming to kids (Part 1) Introduction

Day 598 of 1000

This is the first 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.

[Next post]

We have two children.  Christian was very interested learning to program at a young age.  Kelly was not interested at all.  We systematically taught Christian how to program as part of his homeschool curriculum so that he was able to get an summer internship as a programmer by the time he was 15.  Even though he has sound programming skills, looking back, we think we could have done a better job.  Kelly, even though she was disinterested, would have benefited greatly from some computer programming instruction.   This series describes what we did well, what we did poorly, and our idea of what we would do if we had to do it over.

We started to teach Christian to program when he was about 11 years old.  He actually worked on some operating system stuff both for PC’s and his Palm Pilot before that.  Kelly did not start to learn programming until she was 18 (this year) in SAS and Java courses at college with the exception of some work with the R statistical programming language last summer.  We think we did a good job with Christian and a horrible job with Kelly even though she is turning into a pretty good programmer.  Christan is a proficient programmer in a number of languages including C#, C/C++, Python, Java, and assembly language.  He completed one fairly impressive project, a couple of medium size projects, and is currently at work on a technical assembly language program as part of an undergraduate research in Electrical Engineering.  Even though Kelly does not want to program for a living, as a statistician, she has seen she needs programming as a skill that will help her.  She is pretty unhappy that we did not at least give her some of the basics.

The following is a list of posts I plan to make.  The list will probably morph a little as I progress and grow to as long as it needs to be.

Powered by WordPress & Theme by Anders Norén