3. DESARROLLO DEL TFG
3.6 Creación planos de alimentación
By now you should be getting the feel for what programming is about. It isn’t just learning a bunch of rules but about working with those rules to achieve your objectives. Probably the most important single talent needed by a programmer is the ability to keep things simple.
Writing music requires that you learn the rules of musical composition and how to express your intentions in standard musical symbols. But that does not turn you into a composer, it just provides you with the tools to express your musical ideas. Some composers can instinctively compose music, but they still need a way to express it. Some people can instinctively program, but they still need to learn how to express those programs in terms that a computer can translate into an executable program.
You need to distinguish between problems with programming and what we call domain knowledge. If you do not know what anarithmetic meanis then no matter how skilful a programmer you are you will not be able to write a program to work one out. In other words, to write a program to deal with a calculation you have to know how to do that calculation as well as how to write a program. There was an example of domain knowledge in Chapter 1. If you did not know the rules for mixing light then you would not be able to work out what palette code will give you orange, or light gray or magenta.
Domain knowledge is not enough to write a program and programming skill is not enough either. You need to combine the two. As you move through the rest of this book keep that in mind. This is a book about programming but you cannot practice programming without having something to write programs about. When you are attempting a programming exercise never feel embarrassed about asking someone else to help you with domain knowledge, but do try to write the programs yourself.
This also means that you should not feel that you should only write programs for the exercises and tasks that I set. I think trying those exercises will help you understand the theoretical material, but doing them should just be a central spine. Branch out; write your own exercises. Yes, I am serious about that. You would not think much of an English teacher who rejects a story, a poem or a letter that you have written because they did not ask you to do so, nor should you think much of a programming instructor who never encourages you to write programs to do things you have thought of.
If you think of an exercise that you find challenging or enjoyable share it with the rest of us by sending it in so that it can be put on this book’s website to inspire others.
Some programming problems will be completely beyond you and possibly beyond even the most talented programmers; it helps to be able to spot them. One of the classic works on programming is called ‘‘The Art of Computer Programming’’. It is being written by Donald Knuth, one of the most talented programmers the world has seen. He planned to write seven volumes 30 years ago. The world is still waiting for Volume 4 (which is planned to be published in three parts and is currently listed as to be published in 2007). The exercises in that book are graded from 00 to 50. Grade 00 questions are ones that the reader should be able to answer immediately. Grade 50 problems are ones for which there was no known solution at the time of writing. I am not going to give you any of those, but be aware that they exist because you might accidentally set yourself one.
What next?
In the first six chapters I had to introduce a high proportion of C++so that you would have the basic tools you need in order to program. I have also given you a fairly high proportion of example code. You now have sufficient fundamentals to continue with relatively little new C++. Note that this is not because we have covered a great deal of C++; we haven’t. C++is a very large language and the C++Standard Library is substantial. Even when you finish this book there will be a large amount of C++to learn if you intend to become a skilled C++practitioner. But remember that this is not the purpose of this book. My purpose is to help you discover that you can program. If you want to master a high proportion of C++you will
eventually need to study another book (possibly the next volume in this series).
The remaining chapters of this book will focus on a variety of different programming skills. Each chapter will have some specific objective and be built round a suitable problem. Most chapters will introduce small additions to your C++knowledge (but often large concepts). While I cannot promise that you can change the order in which you study the chapters, I expect that will usually be possible. Roberta and other test readers will have tackled the book in the order in which it is presented. That means that they will not spot places where later chapters assume you have mastered earlier ones.