Some programs provide a framework for a user to manipulate data without the user having to produce their own program. Examples of this include word processors, spreadsheet programs. and so on. With these the user writes macro, or script, programs which integrate within the package. With Microsoft products these can be written in Visual Basic. For example, in Microsoft Excel, a macro to select the whole of column A, and then make it bold, and finally to copy and paste it to the D column is achieved with:
Selection.Font.Bold = True
The user can easily call this macro up from a menu, or they can define a hotkey to activate it. In most cases the macro can be written automatically by following the user's actions (such as Tools->Macro->Record New Macro). These can be easily edited and tested, when they are written in Visual Basic, as this comes with an integrated editor and test environment. The Visual Basic scripts can be easily made to react to certain events, such as startup, file saving, and shutdown events.
The technique of generating macros has been popular with users, as it does not require a great deal of programming experience, or for quickly providing a foundation for code devel-opment. Unfortunately it has also proved an excellent opportunity for some people to write macro viruses. These are as easy to write for the virus programmer, as they are for the nor-mal user. A typical technique for the virus programmer is to respond to one of the events which occur within a document, and perform some action. Thus, for example, the document could generate an event to copy itself somewhere, when the user opens the document. Normally this is to copy itself into another file (and thus self-replicate itself). A typical action is to copy the macro to the default template, thus all the new documents will have the virus macro. Macro viruses, and script viruses, in general, are one of the greatest causes of viruses, and allow an easy way for viruses to spread quickly, without initial detection. The global Internet has now allowed a fast channel for their spread.
In many cases though users require to customize their programs, and produce a program which will run on its own. This can be done by a programmer writing a program from scratch, or it could be to customize an existing program. Popular programming languages include C++, Visual Basic, Java and Delphi. A programmer can either select a software lan-guage which is either scripted, interpreted, compiled or assembled. Table 19.1 outlines the main attributes of the different language classifications, which are:
Compiled and assembled languages have the advantage over the other types of languages in that they create a single executable program, whereas interpreted and scripted languages require an interpreter or an application environment to run (such as a WWW browser for HTML). Interpreted languages tend to produce smaller programs, as much of the extra code is built into the interpreter (for example, there is no need to add code for interfacing to the keyboard or display, as the interpreter already has this code, for the specific operating system and system specification).
Figure 1 shows the sequence of events that occur to generate an executable program from a source code file (the filenames used in this example relate to a PC-based system). With this an editor creates and modifies the source code file; a compiler then converts this into a form which the microprocessor can understand, that is, its own machine code. The file produced by the compiler is named an object code file. This file cannot be executed as it does not have all the required information to run the program. The final stage of the process is linking, which involves adding extra machine code into the program so that it can use devices such as a keyboard, a monitor, and so on. A linker links the object code file with other object code files and with libraries to produce an executable program. These libraries contain other object code modules that are compiled source code.
Figure 1 Compilation, assembly and interpretation
The complication and linking stages generate either warnings or errors. If they generate errors then the source code must be modified to eliminate them and the process of compilation/linking begins again. A warning in the compile/link stage does not stop the compiler or linker from producing an output, but errors will. All errors in the compilation or linking stage must be eliminated, whereas it is only advisable to eliminate warnings.
The type of programming language is typically defined as either a high-level language or a low-level language. A high-level language uses an almost English-like syntax, so that it is easy to read and write the program. An example statement is:
if (x> 3) then y=10;
which says that: 'if x is greater than 3 then y is equal to 10'. In a high-level language mathematical operations are also defined in a way which is similar to the format which is typically used for mathematical notation, such as:
x = 2 * y + 7 * z;
A low-level language uses statements which are similar to the machine code of the mi-croprocessor. These are often difficult to remember, and understand, thus it normally takes a great deal of skill to properly write programs using a low-level language.
It's a very helpful and knowkledgable site and very neatly and creatively presenated. In one word it's really very impressive. One thing a little bit irritating, which is the sound file, It's cause destraction while trying to concentrate on something.