I’ve been away for the weekend (mother-in-law’s) and thought about why anyone should want to program: whether it be for a console game or on a robot. It is going to be different for different people but most commonly it is because you like to see (or hear) stuff happening based on a pure set of instructions you give to a bit of hardware. I think it is a bit like cooking. You build a recipe which, when followed, will create a great meal. Like cooking though, outside influences or mistakes in following the recipe will give some very odd results. With experience, more of the programs you write will start to work first time. At whatever level, you’ll be glad of a good debugger so also learn how to debug well.
I’ve started writing about what it takes to get a program in C++ but that is a really bad place to start. C++ is hard if you’ve never programmed before. If you’ve never ever programmed then you should look at Python or Java to get you started, and don’t try to write a game first. In order, I’d suggest the following:
- Program to solve something. Use the computer like a programmable calculator.
- Program to control something. A robot is my suggestion if you can build it, otherwise the usual school example is to control traffic lights.
- Program to simulate something. A bouncing ball or firing a cannonball on a 2D screen.
- Program several aspects. Bounce a ball that can hit a target and provide a score. Although this is small, there is a right way and a wrong way to do this. Keep the different aspects of the code separate so that they can be replaced with other systems.
After these, you’re on you way to understanding how a computer programmer works. You’ll also know what I mean when I say, “open your IDE or favourite editor.” There are plenty of tutorials on the web to get you started. I’ll get around to linking to some here.