Menu Programmierung
Programmierung

Programming

What I always wanted to say about programming:

About programming

Geri's Prog

On this page:

About this project

There are innumerable articles on the Internet by people who feel called to be tutors and who are devoted to bloody beginners. Well, here is my contribution to this, whereby professionals and old hands are not excluded, hopefully the text will still be entertaining for you.

It is not intended to create the illusion that you can learn all about programming here.

With this work I would like to give you an understandable insight and try to maintain a reading flow and still divide the text into structured topics.

General information about computer programming

Programming means describing a process of how something is to be carried out in detail, i.e. specifying all the steps that are necessary to complete a certain task. This list of steps must specify exactly what is to be done. If you say to someone: "Go to the door", you also have to tell a robot that it has to lift its right foot slightly if it is not already lifted and then move it forward, etc., so you have to explain to the robot how to go and that with every step. The computer can remember what has to be carried out and forgets the instruction while it is being done. In order to let the robot go to the door, all the details for each step must be entered again. The development of computers is not yet so advanced that computers can learn anything independently, so that a robot could walk alone after 2 to 3 steps.

Machine code, the only language the computer understands

nach oben

In order for the computer to be able to process such a description, it must be determined what the description should look like. A set of rules for such a description defines some processes that can be carried out: commands or instructions in a programming language. This programming language for all computers is assembly language. Machine code that consists of fairly short instructions, mnemonics, which are translated into a kilometer-long sausage of zeros and ones and fed to the processor. With these commands from a very small vocabulary, little is possible and usually only a single byte can be processed. As a result, such assembly language programs are difficult to read and write, but the only language computers understand to this day. The idea of ​​developing high-level languages, programs that are easier for people to understand and that are then automatically converted into hardware-related machine code by a program, therefore called source code or source text, came up very early on. One of these first programming languages ​​is Fortran and dates back to 1957.

Programming languages

nach oben

All programming languages ​​for computers ultimately have to be translated into assembly language. This automated conversion generates more machine code than would be necessary for the program, due to the fact that optimization by any program, no matter how sophisticated, reaches its limits. There is still a right to exist for assembler programmers who forego the convenience of high-level languages ​​in order to get the most out of time-critical tasks such as 3D graphics, because machine code commands can directly access values ​​in the processor registers and are executed extremely quickly. What the computer sees from a program has seldom been entered directly by a human. To name a few programming languages:

Assembler PL/I FORTRAN Java
Algol Objective C APL C#
PROLOG SmallTalk ADA  
COBOL Basic RPG  
Pascal Object Pascal Centura CTD  
C C++ Visual Basic  

All these programming languages ​​have one thing in common, they consist of a vocabulary of commands and instructions and are comparable to a cooking recipe only in much more detail. However, there are major differences between these languages. On the one hand through the different syntax, the grammar of programming languages ​​and the way in which they are translated into machine code.

Interpreters for programming languages

nach oben

A translation program is called a compiler that converts a program after it has been completed. One speaks of interpreters who translate a program while it is running into machine code understandable for computers and it has to be interpreted every time it is used. The reason why there are interpreters is that some programming languages ​​are particularly easy to understand for humans, due to the integration of vocabulary from the English language, which, however, cannot easily be translated into machine code, such as Basic. To do this, a collection of miniature programs that are already compiled is used so that the basic instructions do what they should. If you use the PRINT command in Basic, the interpreter executes a code that carries out all the individual steps of the PRINT command. Explanation: the PRINT command from Basic is there to output something on the screen or printer. Countless small actions are necessary for this to happen. The basic programmer does not have to tell the interpreter how to execute the PRINT command, he has no idea about it, because for him it is only important that something comes on the screen but not how. Imagine if you had to control every pixel when you output a single character on the screen. Software developers would then be constantly distracted and unable to concentrate on the essentials. Another reason to use an interpreter is to have better control in the event of a programming error. In any case, the interpreter only delivers optimized code and the computer does not crash as easily as it would with compiled programs. So there is a certain security framework for the programmer so that he does not inadvertently cause a fatal error. So it is particularly interesting for beginners, for whom the speed disadvantage compared to the compiled programs does not play such a big role. However, that does not mean that programming languages ​​that are interpreted are of no interest to professionals, they also benefit from the advantages. There are other disadvantages to interpreted languages ​​besides speed. So that a program can be interpreted, an interpreter must be available on the computer. To ensure that a program also works, it should be installed, that is, all components of the interpreter must be packed with the program in one package, the so-called runtime library. Compiled programs are usually already executable without installation, since they already have processor rights. Interpreted programs are also compiled beforehand, but not to machine code but to native P-code, a kind of intermediate stage.

Programmieren und Legospielen

nach oben

The advantage of dealing with finished building blocks also limits the possibilities. After all, you can't design a new Lego block while playing Lego. Only the manufacturers of Lego can do this, just like the interpreters for programming languages. Perhaps the example with the Lego also applies to the differences between compilers and interpreters. For example, if you build a house out of Lego and one out of clay, the Lego house is the winner in terms of construction time, the stability would probably be equal, but there are differences in the individuality and also in the heat resistance. This is how you can tell from one house that it is made of Lego. The clay house has to be burned first, but then it is bombproof. There is no need to compromise on looks. This comparison relates less to the appearance of a program, because programs do not necessarily have to have a user interface. It is only intended to demonstrate the different procedures for creating them. This difference becomes particularly clear with Visual Basic and C ++. In C ++ you also have the freedom to design building blocks that can then be used with Visual Basic 6.0 SP2.

OOP the fine art of object-oriented programming

nach oben

This also shows the principle of object-oriented programming, which is not a programming language but a pragma that can be used in various programming languages. Components, called objects, are available as construction drawings and are generated when required. The object-orientation, however, has nothing to do with the difference between interpreter and compiler, because you can also program object-oriented in Visual Basic. A characteristic of OOP is that tasks from the real world can be mapped in a similar way in the source code. The example with the robot, to which every step must be explained: In the object-oriented approach, the robot is represented as a unit and a method for walking called "move" is implemented, which summarizes all the details of a step in it. Furthermore, you could define a property that indicates whether the robot is at the door. Now you could say to the robot: "Move. Are you at the door?", "No", "Keep moving". On the one hand, the programming effort is significantly reduced because everything that belongs to a step is integrated, such as checking whether one foot is further forward than the other, weight has to be shifted and whether the leg should be angled. The programmer only needs to repeatedly invoke the "move" method and no longer has to worry about the robot keeping its balance. An equally powerful advantage over linear programming is that you can create more robot clones. A second instance of the robot that behaves like a twin brother but has its own "move" method and also the property of whether it is at the door or not. The robots are exactly the same, but act independently of each other. It becomes even more advantageous if another type of robot is used, perhaps one on wheels. The class, the construction template, of the first robot can serve as a basis and only needs to be changed slightly, because the "move" method was originally made for walking and not for driving. Another class can be derived from the first class, which implements the "move" method differently but still retains the property of whether he is already at the door. Here at the latest it becomes clear that this is not possible at all with procedural programming languages ​​or only with enormous effort.

Other programming languages

nach oben

The programming languages ​​can also include the script languages, which do not necessarily have to be compiled immediately before they can be processed further by an interpreter. These scripts are usually not independent programs and usually have no user interface, as they are often only used for smaller tasks. The scripts also have to be interpreted and additionally compiled and this extra effort costs time. The advantage of the script languages ​​is the flexibility when it comes to changes and adjustments in the source text, since this is only compiled during execution, no compiler has to be used and is ready for use immediately after the adjustment. Scripts do not have to be installed either, but their interpreter with the integrated compiler does (usually web browser). Script languages ​​often have deliberately limited options compared to the "right" programming languages ​​with regard to file access, in order to prevent a malicious script from damaging the file system.

Macro languages

nach oben

Many applications allow the automation of tasks that are to be carried out repeatedly. This saves a lot of time for repetitive activities such as saving files under certain names. All these actions can be recorded in a macro and later carried out at the push of a button. These macro languages are not suitable for writing programs that can be executed independently. It is not enough that the application that supports macros is installed, it must also be started.

Batch files

nach oben

In addition to all these languages, there are also batch files which, in a special syntax, allow some typical programming applications, i.e. certain instructions, e.g. IF or FOR, and can record user inputs. These batch programs can contain all commands that can be started via the command prompt, i.e. also format the hard drives. It is therefore very advisable to treat a batch file with caution and to check the content in a text viewer if you are new to it, or better to keep your hands off it. Often such batch files are added to games in order to start them with certain default settings. With the help of the batch files, e.g. backups in a network can be automated, database servers can be started or stopped and much more. Batch programs do not have their own user interface and can only process inputs and outputs via a console with a command prompt.

Other languages that are important for programming

nach oben

There are also languages for text markup and database queries that are not programming languages, but are often used in them, such as SQL (Structured Query Language) or XML (Extensible Markup Language). HTML is also important for programmers of all disciplines, so it is definitely worth learning the syntax of these languages.

Programming languages are alive

nach oben

In order to be able to program, it is necessary to know what types of commands are available and which syntax rules apply. However, you do not have to master the entire range of languages in order to work with a programming language, it is also not necessary to know the Duden by heart to read a newspaper. Many programmers, including myself, often work around a problem out of ignorance without knowing the useful commands designed to address that problem. It is all too easy to get used to such workarounds because at some point there may really be no elegant solution for something. Later, in newer versions of these programming languages with a newly added command, e.g. a solution will be offered. The programmers then often do not know anything about the new possibilities. It is therefore important for software developers to keep up to date and keep an eye out for news.

nach oben


Edited by Gerhard Porpaczy, created: 07/04/2011 last update: 16.06.2022
All content originates from my pen and is subject to copyright ·geri3d·