Wiley Beginning Python 978-0-7645-9654-4 Manuale Utente

Codici prodotto
978-0-7645-9654-4
Pagina di 12
Note that programming in a language like Python, an interpreted language, means that you are not
going to need to know a whole lot about computer hardware, memory, or long sequences of 0s and 1s.
You are going to write in text form like you are used to reading and writing but in a different and sim-
pler language. Python is the language, and like English or any other language(s) you speak, it makes
sense to other people who already speak the language. Learning a programming language can be even
easier, however, because programming languages aren’t intended for discussions, debates, phone calls,
plays, movies, or any kind of casual interaction. They’re intended for giving instructions and ensuring
that those instructions are followed. Computers have been fashioned into incredibly flexible tools that
have found a use in almost every business and task that people have found themselves doing, but they
are still built from fundamentally understandable and controllable pieces.
Programming Is Consistency
In spite of the complexity involved in covering all of the disciplines into which computers have crept,
the basic computer is still relatively simple in principle. The internal mechanisms that define how a com-
puter works haven’t changed a lot since the 1950s when transistors were first used in computers.
In all that time, this core simplicity has meant that computers can, and should, be held to a high stan-
dard of consistency. What this means to you, as the programmer, is that anytime you tell a computer to
metaphorically jump, you must tell it how high and where to land, and it will perform that jump — over
and over again for as long as you specify. The program should not arbitrarily stop working or change
how it works without you facilitating the change. 
Programming Is Control
Programming a computer is very different from creating a program, as the word applies to people in real
life. In real life, we ask people to do things, and sometimes we have to struggle mightily to ensure that
our wishes are carried out — for example, if we plan a party for 30 people and assign two of them to
bring the chips and dip and two of them to bring the drinks.
With computers that problem doesn’t exist. The computer does exactly what you tell it to do. As you can
imagine, this means that you must pay some attention to detail to ensure that the computer does just
what you want it to do.
One of the goals of Python is to program in blocks that enable you to think about larger and larger pro-
jects by building each project as pieces that behave in well-understood ways. This is a key goal of a pro-
gramming style known as object-oriented programming. The guiding principle of this style is that you
can create reliable pieces that still work when you piece them together, that are understandable, and that
are useful. This gives you, the programmer, control over how the parts of your programs run, while
enabling you to extend your program as the problems you’re solving evolve.
Programming Copes with Change
Programs are run on computers that handle real-world problems; and in the real world, plans and cir-
cumstances frequently change. Because of these shifting circumstances, programmers rarely get the
opportunity to create perfectly crafted, useful, and flexible programs. Usually, you can achieve only two
of these goals. The changes that you will have to deal with should give you some perspective and lead
you to program cautiously. With sufficient caution, you can create programs that know when they’re
2
Chapter 1
04_596543 ch01.qxd  6/29/05  10:59 PM  Page 2