Learning To Program – A Beginners Guide – Part One

by Matthew Adams

Introduction

Programming, like most crafts, is the process of taking one thing and turning it into another thing. Turn a touch on a screen into a character in a message, or a tap on controller into the sideways shuffle of a character in a game. Simple to describe, they’re actually quite complicated to achieve, involving many thousands (or even millions!) of such processes, all chained together.

The Art of Programming is breaking those big problems down into ever smaller chunks, organizing them so that we can keep them in our heads without going crazy, and recognizing patterns that we can apply again and again to solve the same kinds of problems.

Being a programmer is quite new, as crafts go. If you worked in wood, or metal, you’d have thousands of years of experience to draw on. Most of the tools we use today would be recognizable to people working 1,000 years ago – albeit that they are often now computer controlled and operating unimaginably more quickly, and reproducibly.

But our craft, give or take some early precursors, is only about 70 years old. Not only are the tools (the programming languages and environments) still developing, but the raw materials we’re working with (computers, sensors and output devices) are evolving all the time. It’s rather like the copper age, bronze age, iron age and the invention of steel and modern alloys all happened in a single lifetime, and we’re still racing to keep up.

So it can all be rather confusing.

The great Medieval Cathedrals in Europe were built by craftsmen. They used their experience, guile and a fair slice of dumb luck to build awe-inspiring edifices, most of which have stood the test of time. Admittedly, some have collapsed spectacularly, and bits have fallen off other ones, or the roofs have caved in, and they’ve need centuries of botching and buttressing and patching. But they’re still there.

We don’t build spectacular architecture in that way anymore. Scientists have worked out a load of really useful theory that helps us to understand the forces involved, model them, and allow the current generation of craftspeople to design and construct buildings that look almost impossible to us, let alone those medieval cathedral guys.

A computer programmer today is rather like one of those medieval craftsmen. We build incredible things through experience, guile and a fair slice of dumb luck, but sometimes things collapse spectacularly, bits fall off, and they almost always need constant botching and patching to keep them running.

A few people come to computer programming through an academic Computer Science route at University. Many more are drawn this way through happy accident, and there is a definite divide between the Scientists and the Craftspeople. We’re going to try to close up that divide a bit, and learn a bit of the science that underpins our craft as we go along, in an effort to be more like a modern architect than a medieval one.

Computer Science is a very important discipline, closely related to Mathematics, and responsible for the fundamental advances in our subject from the first ideas of computability (we’ll come on to that later), to stored program computers (like the one in front of you), to many of the programming languages, tools and algorithms (we’ll come onto those too) we use today.

If you want to learn the craft of computer programming you don’t have to be a computer scientist, or an awesome maths whizz, but you are going to end up learning a fair slug of maths along the way – at least, some particular bits of it. If you’re interested in computer graphics, even more so (who’d’ve thought all that trigonometry was going to be useful?)

In this series, we’re going to assume that you’ve got some basic high school maths. You’re comfortable with addition, multiplication and division, squaring numbers, and calculating percentages; and can, if you’re forced to, remember (or look up) how to do things like long division by hand. If you’re OK with that stuff, you’ve got the fundamental apparatus to start thinking like a programmer. Even if you’re not super-confident don’t worry! We’ll be taking it slowly and explaining everything as we go.

If all that maths talk was scary and baffling and reminds you of your most hated hours at school, take a deep breath. That’s your teacher’s fault, not yours (well, maybe you contributed a bit if you were as sulky a teenager as I was). Remember: it’s never too late! If you’re interested in programming, I’d go and learn a bit of basic maths over here where it is safe and friendly, practice a bit, then come back here in a week if you’ve still got the bug!

The other thing is that we’re not going to be able to leap straight from a standing start to the programming equivalent of a Cathedral. We’re going to have a series of very small triumphs that, eventually, will lead to something like a modest garden outbuilding.

We’ll slave away for a few hours or days or weeks, and learn something new. We’ll know it is a huge achievement, but when we show it to our husband or housemate or colleague, the best we can hope for (if they really like us) is that they’ll stifle their yawn and not make too derisive a snorting noise as you point at the number ‘3’ which has appeared somewhere on the screen along with a load of seemingly unintelligible bafflegab.

The important thing is that we know that it is a breakthrough, and another bit of our craft mastered. That’s what really matters. It’s going to be hard work, but that’s what makes it satisfying.

Ok, there’s one more prerequisite.

I’m going to assume that you’ve got a computer or laptop of some kind that runs a traditional ‘desktop’ operating system. Either Windows 7 or 8, MacOS X, or a popular flavour of Linux. And that you know how to find files, install software and so forth on your preferred computer. Again, you don’t have to be a total wizard because we’ll show you a screenshot/walkthrough of the setup we have to do to be able to start programming, and check it is all OK as we go on, but it’ll help if you know how to use the file explorer/finder and do basic housekeeping tasks.

In the next couple of posts, we’re going to set up the tools that we’re going to use in the rest of this course on Windows or Linux.

Learning To Program – A Beginners Guide – Part One – Introduction
Learning To Program – A Beginners Guide – Part Two – Setting Up
Learning To Program – A Beginners Guide – Part Three – What is a computer?
Learning To Program – A Beginners Guide – Part Four – A simple model of a computer
Learning To Program – A Beginners Guide – Part Five – Running a program
Learning To Program – A Beginners Guide – Part Six – A First Look at Algorithms
Learning To Program – A Beginners Guide – Part Seven – Representing Numbers
Learning To Program – A Beginners Guide – Part Eight – Working With Logic
Learning To Program – A Beginners Guide – Part Nine – Introducing Functions
Learning To Program – A Beginners Guide – Part Ten – Getting Started With Operators in F#
Learning to Program – A Beginners Guide – Part Eleven – More With Functions and Logic in F#: Minimizing Boolean Expressions
Learning to Program – A Beginners Guide – Part Twelve – Dealing with Repetitive Tasks – Recursion in F#

Matthew Adams on Twitter