2014年7月8日 星期二

coding club B1, Introduction


Introduction


Why was this book written?


This book is the first in a series of books for anyone with little or no knowledge of computer programming but who would like to give it a go.

Who is this book for?


One factor was the availability of a computer that any child could save up for or get for their birthday, such as the Raspberry Pi from www.raspberrypi.org.

But my wish to produce a series of short books on coding goes back much further than that. When I grew up, computers were very different from the PCs we use today. To play a game or use a word-processor, you had to run the program by typing green text into an empty black screen. But the great thing was, you could also type in your own commands and run them! It was not long before I had written my first text-based game in a language called BASIC.

Later on, I wanted to learn a more modern language, and set about teaching myself Java. I
read four or five books and completed the examples, but at the end of each one I was left in
a dreadful situation: I had all sorts of ideas for programs I wished to make, but still no idea
how to start! I could make the exciting projects that were the focus of these books, but not
much else. So with this series of books, I have taken a different approach. I hope it will teach
you the skills you need to write any program you can imagine – eventually – and many
simple programs straight away.

Why should you choose this book?


After many years of looking, I finally found a great book on Java called Introducing Java by
David Parsons, published by Thomas Learning. It was for university students. Suddenly I
understood why we did certain things and how to start designing complex programs. If only
I had started with this book to begin with!

I want you, the reader, to learn not only how to make the programs in this book but also how
to design your own. I want you to be able to write programs well, so that if you take it further
and become the inventor of the next Google you will not have to unlearn bad programming
habits. Unlearning things, I should add, is a lot more difficult than you might imagine.

What needs to be installed?


You do not have to do this! Please ask a responsible adult to read the Introduction for Adults
page on the coding club website (www.codingclub.co.uk) so that they can get everything
organised for you. If you are able to do this by yourself then full instructions can be found at
http://python.org/download/. If you are going to learn to program on a Raspberry Pi, it will
be very easy to get things ready as it comes pre-installed with everything you need. You do
not have to use a Raspberry Pi to run Python. You can use Windows, Apple Mac and
Linux systems.

How to use this book


It is hoped that you will read this book carefully and build all the main projects in order.
At the end of each chapter there are further ideas, and challenges that you can think of as
‘mini quests’ in a video game. Some readers will want to work through all of them so that
they understand everything all the time. Some of you will probably prefer to rush through
and get to the end. When these readers think: ‘What can I do now?’ One answer is to go back
and look at some of the ideas at the end of each chapter. Which approach is best? The one
you are most comfortable with. If you are being guided by a teacher though, then to enable
them to help you the most you should trust their judgement.

There are four ways in which this book tries to help you to learn:


  1. By copying the code – this is important as it gets you to work through the code a line at a time (like computers do) and will help you remember the details in the future.
  2. Finding and fixing errors – error messages in Python give you some clues as to what has gone wrong. Solving these problems yourself will help you to be a better programmer. In the end though, this should not become boring, so if you get stuck the code can be downloaded from the accompanying website.
  3. Experimenting – feel free to experiment with the code we write. See what else you can make it do. If you try all the challenges, puzzles and ideas, and generally mess with the code, this will help you learn how to write code like a professional.
  4. Finally, this book will not only provide the code to build some cool, short projects but also teach you how the programs were designed. You can then use the same methods to design your own applications.


A word of warning


You may be tempted to simply get the code off the web site instead of typing it yourself. If
you do this you will probably find that you cannot remember how to write code so easily
later. You will only be asked to type small chunks of code at a time – remember that this will
help you understand every detail of your programs.

You will also become a faster typist, which is a very important skill these days!

b

index

a

index

index


  • d