ProgramsNowadays computers are able to perform many different tasks, from simple mathematical operations to sophisticated animated simulations. But the computer does not create these tasks by itself, these are performed following a series of predefined instructions that conform what we call a program.
A computer does not have enough creativity to make tasks which it has not been programmed for, so it can only follow the instructions of programs which it has been programmed to run. Those in charge of generating programs so that the computers may perform new tasks are known as programmers or coders, who for that purpose use a programming language.
Programming languagesA programming language is a set of instructions and a series of lexical conventions specifically designed to order computers what to do.
When choosing a programming language to make a project, many different considerations can be taken. First, one must decide what is known as the level of the programming language. The level determines how near to the hardware the programming language is. In the lower level languages, instructions are written thinking directly on interfacing with hardware, while in "high level" ones a more abstract or conceptual code is written.
Generally, high level code is more portable, that means it can work in more different machines with a smaller number of modifications, whereas a low level language is limited by the peculiarides of the hardware which it was written for. Nevertheless, the advantage of low level code is that it is usually faster due to the fact that it is indeed written taking advantage of the possibilities of a specific machine.
A higher or lower level of programming is to be chosen for a specific project depending on the type of program that is being developed. For example, when a hardware driver is developed for an operating system obviously a very low level is used for programming. While when big applications are developed usually a higher level is chosen, or a combination of critic parts written in low level languages and others in higher ones.
Although there are languages that are clearly thought to be low level, like Assembly, whose instruction sets are adapted to each machine the code is made for, and other languages are inherently high level, like the Java, that is designed to be totally independent of the platform where is going to run. The C++ language is in a middle position, since it can interact directly with the hardware almost with no limitations, and can as well abstract lower layers and work like one of the most powerful high level languages.
Why C++?C++ has certain characteristics over other programming languages. The most remarkable are:
- Object-oriented programming
- The possibility to orientate programming to objects allows the programmer to design applications from a point of view more like a communication between objects rather than on a structured sequence of code. In addition it allows a greater reusability of code in a more logical and productive way.
- You can practically compile the same C++ code in almost any type of computer and operating system without making any changes. C++ is the most used and ported programming language in the world.
- Code written in C++ is very short in comparison with other languages, since the use of special characters is preferred to key words, saving some effort to the programmer (and prolonging the life of our keyboards!).
- Modular programming
- An application's body in C++ can be made up of several source code files that are compiled separately and then linked together. Saving time since it is not necessary to recompile the complete application when making a single change but only the file that contains it. In addition, this characteristic allows to link C++ code with code produced in other languages, such as Assembler or C.
- C Compatibility
- C++ is backwards compatible with the C language. Any code written in C can easily be included in a C++ program without making any change.
- The resulting code from a C++ compilation is very efficient, due indeed to its duality as high-level and low-level language and to the reduced size of the language itself.