Computer program

from Wikipedia, the free encyclopedia

A computer program, or program for short, is a sequence of instructions (consisting of declarations and instructions ) that complies with the rules of a certain programming language , in order to process or solve certain functions or tasks or problems with the aid of a computer .

overview

'Computer program', contexts of terms and synonyms used in language

A computer program belongs to the software of a computer. It is usually on a data carrier as an executable program file , often in the so-called machine code , which is loaded into the computer's main memory for execution . The program is run as a sequence of machine, i. H. Processor instructions of the one or more processors of the computer processed and executed it. Computer program is also understood to mean the source text of the program from which the executable code is created in the course of software development .

A program file, which consists of machine code, contains instructions from the vocabulary of the processor, i. H. Commands that are "understandable" for the processor and can therefore be executed. The creation of such a program is generally referred to as programming or implementation . In the early days of programming - up to the development of programming languages  - programming was done exclusively in machine code. The program or source text that the programmer has written in a programming language consists of a sequence of instructions (mostly taken from the English language) that are generally easier for the programmer to understand (e.g. ADD, SUB, AND, OR ) than the machine code. Later on, loops, abstraction and modular structure supplemented the higher programming languages .

Files in which the program code is stored are usually identified by a file extension. Source text files thus indicate the high-level language used ( <program> .c : a program formulated in C ). It can generally be edited with a simple text editor. A file that contains machine code, on the other hand, has no or an operating system-specific extension that only indicates its executability ( <program>. Exe for MS-DOS and Windows ; <program> for Unix systems). It can often be called up as a command in a terminal ( command prompt ). See also program library .

In order for a program written in a high-level language to be executed on a processor, it must be translated into machine code. An instruction in a high-level programming language is generally translated into several machine instructions. The translation process is called compilation . An assembler , compiler or interpreter is required to generate the machine code from the source text . This translates the instructions of the programming language, which should be understandable and editable for human users, into the semantically corresponding commands of the machine language of the computer used.

The instructions that (as part of programs) represent a concrete solution are called an algorithm ; Example: Calculating sales tax.

In parlance, a computer program is usually shortened to program or the term software is used. However, computer program is not a synonym for software , since software means the complete application ready for the user. This includes additional resources such as the operating system , databases , graphics and audio files , fonts or help texts.

A larger computer program usually consists of several modules - which either belong to the program itself or which are used as building blocks ( subprograms ) from existing program libraries when executing the program. In the opposite case, computer programs can be part of a higher-level application system covering a larger task area ; Example: payroll, financial accounting, reporting .

The development of computer programs is the field of software technology . Depending on the complexity of the computer programs to be developed, this is done as part of projects . The activities of the parties are thereby usually using process models , special methods and tools designed for software development.

Classification options

In addition to the distinguishing features that generally apply to software , computer programs (as a sub-variant of software) can be distinguished according to the following criteria, which are given as examples:

  • Source programs (in a certain programming language ) or machine programs (executable under certain operating systems ) or programs in an intermediate code
  • Main programs (called via operating system commands) or subroutines (called by other programs). Special forms occur when programs e.g. B. can be called via technical control components, z. B. via service-oriented architectures , automated workflow management .
  • Batch programs (process 'batches' of data) or dialog programs (interact with users)
  • Depending on the location of storage and program execution, programs can be saved and executed locally (on a workstation computer) or installed on a server and still executed locally (after loading via an online connection) or only saved on the server and also there are executed. In distributed applications, parts of the program are executed on different computers, e.g. B. the business logic and data storage in the server, functions of the user interface on the local computer; In a purely technical sense, different programs are connected to one another.

history

Ada Lovelace's first computer program

The world's first computer program is a rule for the calculation of Bernoulli numbers , which Ada Lovelace created in the years 1842/1843 for the mechanical analytical engine by Charles Babbage . At that time, the program could only be carried out by hand, since in the 19th century there was no functioning machine capable of doing this.

First programs on punched tape

From 1936 to 1941 Konrad Zuse designed the Z1 and Z3 computers, which processed long sequences of commands on a punched tape, the first computer programs that could be executed on real machines. The computers mastered the four basic arithmetic operations and square root calculations on binary floating point numbers , the punched tape each contained an arithmetic operation and a memory address.

The first high-level programming language Plankalkül also goes back to Zuse . This means that problems can be formulated independently of the machine and later converted into a machine-readable form.

Programs in memory

The EDVAC computer, which is based on a design by John von Neumann from 1945, had a mercury delay memory for 1024 fixed or floating point numbers with 44 bits each. Instead of a number, each memory cell could also accept an instruction. With this computer concept it was possible to first transfer the commands of a computer program to the main memory before execution. This is still common today. However, EDVAC was not partially completed until 1951. The Manchester SSE demonstration computer and the EDSAC computer based on the EDVAC had already executed programs from the main memory.

High level programming languages ​​and compilers

At the end of the 1950s, computers became so powerful that special programs called compilers could automatically translate source texts in high-level programming languages ​​into machine instructions, i.e. executable programs . As with EDVAC, executable programs can then be loaded into the memory and processed.

With Fortran , COBOL , ALGOL and LISP , the first standardized high-level programming languages emerged in the late 1950s. Programs in these languages, translated by an appropriate compiler, run on different computers. Some of them can still be used on modern computers.

From the algorithm to the program

Calculating the greatest common divisor

A program is to be created to determine the greatest common divisor (GCF) of two numbers. First a suitable algorithm has to be found.

The Euclidean algorithm , which dates back to 300 BC. BC, determines the greatest common divisor (GCF) of two natural numbers a and b :

  1. Let a be the larger of the two numbers a and b.
    If a is less than b, swap the numbers.
  2. Set a to the value a - b.
  3. If a and b are not the same, go to step 1.
    If a and b are the same, then the algorithm is finished.
    This number is the greatest common factor.

Use of a programming language

As soon as a formal description of an algorithm, i.e. a precisely defined processing rule, is available, the algorithm can be implemented . A suitable programming language is selected for this.

Today, a high-level programming language is usually used for implementation, which may not be able to be executed directly by a computer, but must first be compiled or interpreted.

In languages ​​such as Pascal , variables, expressions, comparisons, assignments and control structures are used to implement the GCD algorithm:

while a <> b do         // Schritt 3: solange a ungleich b
begin
    if b > a then       // Schritt 1: falls b größer als a
    begin
        temp := a;      // a und b vertauschen
        a := b;
        b := temp;
    end;

    a := a - b;         // Schritt 2: a durch a - b ersetzen
end;

Consideration of all special cases

The implementation begins with the examination of step 3. The original algorithm does not consider the case that a and b can already be the same at the beginning. If the task were to find the greatest divisor of 103 and 103, a person would immediately name the result 103, he would not even bother with the algorithm. But the original algorithm would result in zero. The implementation on a computer must also take into account all special cases. By bringing forward step 3, the special case is handled correctly here.

Elementary steps

Pascal and other programming languages ​​do not have an operation for swapping numbers. This must therefore be implemented in more elementary steps. The additional variable temp, a so-called auxiliary variable, allows swapping with the help of three assignments:

temp := a;      // Wert von a in der Hilfsvariablen temp retten
a := b;         // a mit dem Wert von b überschreiben
b := temp;      // b mit dem Wert von temp überschreiben

This is also a small algorithm.

A complete program

In order for it to become a correct program, the algorithm has to be supplemented with input and output instructions, but often also with variables and a program structure. These are not part of the actual algorithm:

program Ggt;                        // Programmkopf
    var a, b, temp: Integer;        // Variablendefinition
begin
    ReadLn(a, b);                   // Eingabe von a und b

    while a <> b do                 // Euklidischer Algorithmus
    begin
        if b > a then
        begin
            temp := a;
            a := b;
            b := temp;
        end;

        a := a - b;
    end;

    WriteLn(a);                     // Ausgabe von a
end.                                // Programmende

Translation and execution

Such a program is created using a text editor and stored as source code in a file or program library (for source code ). The source code can then be 'translated' into a fixed sequence instruction for the computer. This requires a compiler that translates the code from the respective programming language into the machine language and creates an executable program as a result , which is stored as a file or in a program library (for executable programs). This program can then be started for execution via an operating system , and as often as required (without a new translation).

Some programming languages ​​do not use a compiler but an interpreter that translates programs into machine language only at runtime .

Another possibility is to use intermediate code ( bytecode ) that is generated by the compiler instead of the machine code. One example is Java : The Java compiler generates bytecode , which is then executed on the so-called virtual machine . The virtual machine then interprets or translates the bytecode for the underlying operating system.

Likewise, in some computer environments, usually with mainframes , the machine code created by the compiler still has to be post-processed with a system program ('Linkage Editor' or similar), whereby further sub- programs and system routines can be 'integrated' if necessary . Only then can the resulting program be executed .

Using special programs, so-called decompilers , it is possible to a limited extent to generate a source text that can be read in high-level language from the machine code.

Phases of life

Programs have at least two clearly separated phases of life: The period up to the time of compilation (inclusive) is called compile time , which is in contrast to the runtime . In the compile time phase, the program has static properties , given only by the fixed source code. After compilation and execution, the binary program has dynamic properties and behavior that also depends on the respective runtime environment (varying hardware, user interaction, etc.).

In a more detailed sense, the life phases of programs can also be understood as the software life cycle . Accordingly, the precise definition of the program content includes the project phases problem definition , analysis and design , followed by the technical implementation in which the program is created in the form of source code . It is then in the introduction phase . After these development phases of programs their productive use follows , if necessary adjustments and extensions ( maintenance / care phase ) are made.

From a business point of view, computer programs can also be classified according to the general product life cycle .

Copyright protection

A computer program is protected by copyright if it is the individual result of the author's own intellectual creation ( Section 69a (3) UrhG). With the implementation of the Copyright Directive from 2001, the protection threshold for computer programs was harmonized in the EC member states. A minimum of individuality is sufficient for protection ( small coin ). It is assumed that the individuality of the author was reflected in the program, if there was scope. Spiritual content is presumed if the program was created by a human author.

development

In the Federal Republic of Germany, the legal recognition of copyright protection took place in 1985; the jurisprudence already considered it possible beforehand.

In 1991 the directive 91/250 / EEC on the legal protection of computer programs followed, in 1993 legal regulations in Austria and Switzerland and 1996 in Liechtenstein.

In 1979, the case law in the GDR denied the ability to be protected by copyright, but the award of software by partners other than the developing business entity could be excluded in commercial contracts for scientific and technical services.

See also

literature

Web links

Wiktionary: Computer program  - explanations of meanings, word origins, synonyms, translations

Individual evidence

  1. ISO / IEC 2382-1: 1993 defines "computer program": "A syntactic unit that conforms to the rules of a particular programming language and that is composed of declarations and statements or instructions needed to solve a certain function, task, or problem . ”Until 2001, DIN 44300 defined“ Information processing terms ”identically.
  2. Law on the amendment of regulations in the field of copyright of June 24, 1985 ( Federal Law Gazette I p. 1137 ); BT-Drs. 10/3360
  3. BGHZ 94, 276 ("Inkasso-Programm", May 9, 1985)
  4. Copyright Law Amendment 1993 - UrhGNov 1993 , Federal Law Gazette No. 93/1993 ; see also OGH , RIS-Justiz RS0076609
  5. Federal Act on Copyright and Related Rights (Copyright Act, URG) of October 9, 1992, AS 1993, 1798
  6. Ordinance on certain property rights in the field of intellectual property (VGE) of January 30, 1996, LGBl. 1996 No. 31
  7. ^ District Court Leipzig, NJ 1981, 236
  8. Central Contracting Court , Spruchpraxis 11, 35 = Commercial Law 1984, 21 = GRUR-Int. 1984, 305 (on Section 18 of the 1st Implementing Ordinance to the Contract Act)