Preface
What this book is about
In today's information age, computers are all around us. Computers are in our vehicles, in our televisions, our microwaves, our telephones, and countless other devices we use daily. One question to think about is how do these computers know what to do? They are just made out of silicon [i.e. sand], metal, carbon, and a few other elements. The truth is, they don't know what to do. They have to be told what to do and how to do it and the only way to do that is to give them instructions on how to do something. The instructions to do a particular task for computers are collectively called a program.Each different type of computer can possibly have different sets of instructions that it understands. These sets of instructions are called a programming language. A programming language can be thought of like a human spoken or written language. English, for example, has different words in it than a language such as French. They possibly have the same words in both, and the words could mean the same or they could mean something completely different. A person can know only English, or only French, or a person could know both of them. The same is true with computers. A computer could understand languages such as Assembly, C, Java, Pascal, or Basic (think of these like they are human languages that you've never heard of).
Just as human languages come from different families of languages, such as French and German are of the Romantic language family, the same is true with computer languages. For example, under the C family of computer languages are programming languages such as C, C++, C# [pronounced C sharp], and Java. Under the Basic family are languages such as BASIC, BASICA, Qbasic, QuickBasic, and Visual Basic.
Some human languages are not used anymore, except for very special purposes. Examples of these languages are Egyptian, Ancient Greek, and Ancient Hebrew. The same is also true of computer languages. Programming languages such as Cobol, Fortran, and Pascal are rarely ever used anymore except for very specific purposes.
Each computer language has its advantages and disadvantages, just as human languages. BASICA, for instance, is a very easy language to learn but it is limited and extremely slow. C++, on the other hand, is harder to learn but is extremely fast. For this reason and others, computer languages are picked by a programmer according to the problem they wish to solve. The computer language Fortran, for instance, is great at solving math problems.
You're still probably asking yourself, "Why do we need to program a computer?" The simplest answer is because the computer cannot do anything without it being told what to do. It must be told by someone how to do everything, including what steps to go through when it is turned on! The only way to tell a computer how to do something is to write a program to tell it what to do. In order to do this, the programmer must know what the problem is that is needing to be solved and must also know the computer language in which to solve. If these two things are known, a program can be easily written to solve the problem. The problem could be as simple as how to write a word onto the screen or as complex as flying the space shuttle.
This book is intended to teach anyone how to program a personal computer. A basic understanding of how to use a computer [preferably one that has been programmed so that it is usable J], and an understanding of basic middle school Algebra is also helpful. I plan to cover some of the more common languages used such as C, C++, Java, and HTML and also some of the lesser-used languages such as Qbasic and Assembly. Some of the more complex languages, such as Java and Assembly, will be handled near the end of the book to allow important topics to be covered and explained thoroughly. Other languages, specifically HTML, will be covered first and only within the first few chapters as they are not complex languages.
This book is not meant to be an all-inclusive reference to each of these languages. If it were, this book would be several thousand pages long. It is meant to be an introduction only.
Conventions
There will be several places within this book where code, new terms, user input, and so forth will be used within the text. The table below shows how each of these conventions will look throughout the book.Convention | Meaning |
Bold | New term |
Code | In-text code. Usually just a single command or line |
Program | Multi-line code segment or program. Lines will be indented slightly from the book's text |
computer output | Computer's output from a program |
user input | User's input into a program |
Error | Error or mistake within program or an error that the computer produced |
Table 1 – Conventions used throughout the text
An Apology
The computer field has been around for over 50 years and it has added many words to the English language. In many instances there are multiple words to mean the exact same thing. I will try to stick to the same set of terms throughout the entire book, but if I slip, please forgive me.Also, computer programming is not an easy topic to explain at times. I will do my best to explain it, but if I confuse you, forgive me. Sometimes it is best to just sit down and experiment with a new concept and to figure out how it works yourself. You will not make the computer blow up if you do something wrong. The worst that could happen (at the introductory level anyway) is that you may have to reset the computer. Experimentation is always the best way to learn, especially when dealing with computers.
Special Thanks
A special thanks to Heather Rawlins who got me to write this book in the first place and for always being there for me. To Mrs. Pam Leary for showing me how to add two plus two in BASIC on an old TRS-80 Model III many years ago. To Microsoft for creating the tools and languages to allow programmers to create their own software. To all my friends who have put up with me through the years. To Dr. Abrahamson, Dr. Wirth, and Dr. Prichard from East Carolina University for putting up with all my questions, allowing me to catch their mistakes without getting too mad, and for teaching me more about computer science. If I've missed anyone, it's not that I haven't thought about putting you in here. I don't want to write a book of just "thank you"'s. If I've offended anyone by not including you in here, email me and complain about it.
No comments:
Post a Comment