Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Beginning Programming for Dummies 2004.pdf
Скачиваний:
109
Добавлен:
17.08.2013
Размер:
8.05 Mб
Скачать

48

Part I: Programming a Computer

Linux and the open source movement

In the early days of computers, programmers freely created and shared the source code for their programs. The idea was that, if enough people voluntarily worked together on a single program, the chances were good that the program would actually work.

Then programmers decided that they should get paid for their hard work, so they started keeping the source code for their programs to themselves, which helped to spawn the software industry as we know it today (with all its missed deadlines, unreliable programs, and horribly written software manuals).

But now the idea of sharing the source code (often known as the open source movement)

has resurfaced with the emergence of the Linux operating system. Users can again peek at the source code without paying for it.

Having access to the source code gives you the option of modifying the program if you want or (more likely) hiring someone else to modify it for you. In any event, access to the source code prevents you from being at the mercy of companies that refuse to reveal their source code so that they can force you to pay for program upgrades that still may not fix or add the features that you want.

You may want to use the following additional tools in writing a program:

A debugger (which helps identify problems or bugs in your program).

A Help file authoring program (so that your program can provide Help on-screen instead of needing to supply the user with a decent manual).

An installation program (to copy your program to the user’s computer).

If you buy a specific programming language, such as Visual Basic, Delphi, or Real Basic, you usually get an editor, compiler, and a debugger, which means you just need to buy a separate Help file authoring program and an installation program.

Writing Programs in an Editor

As you write a program, you must type your instructions in a text (or ASCII) file. Although you can use a word processor to create a text file, a word processor offers fancy formatting features (such as changing fonts or underlining text), which you don’t need to write a program.

Chapter 4: The Tools of a Computer Programmer

49

An ASCII file consists of nothing but characters that you can type from a keyboard. ASCII stands for American Standard Code for Information Interchange, which is simply a universal file format that any computer can use.

A program consists of one or more instructions that tell the computer what to do. The instructions that make up a program are known as the program’s source code.

Rather than struggle with a word processor, programmers created special programs for writing, editing, and printing the source code of a program. Almost no one writes a program correctly the first time, so the majority of a programmer’s time is spent editing the source code. As a result, the program that enables you to write, edit, and print a program is known as an editor.

An editor looks like a word processor but may offer special features to make programming easier, such as automatically formatting your source code, offering shortcuts for editing your source code, or providing pop-up Help as you’re typing program commands. An example of an editor’s pop-up Help is shown in Figure 4-1. Anytime that you need to write or modify the source code of a program, you must use an editor.

Figure 4-1:

The Visual Basic editor displays a pop-up window that shows you the correct syntax for a particular command.