Modern high-level programming language: examples and comparisons. Brief overview of famous programming languages ​​Extensions of programming languages

GPUs are now increasingly being used to solve computing problems, but the question is still open: how to write effective programs for the appropriate configurations?

06/15/2011 Andrey Adinets

GPUs are now increasingly being used to solve computing problems, but the question is still open: how to write effective programs for the appropriate configurations? The standard solution - a combination of CUDA or OpenCL - allows you to implement the algorithm relatively quickly, but using them to create a version optimized for a specific configuration is difficult. Tools for programming GPUs at a higher level are required, which can be created, for example, using extensible languages.

Just three years ago, graphical processing units (Graphical Processing Units, GPUs) were considered only as video cards for PCs, but now the attitude towards them has changed - special server GPU models have appeared, focused on solving computing problems, the performance of double-precision calculations has increased, systems have emerged record performance, ranking at the top of the Top500. How to write effective programs for such machines? The standard answer is a combination of CUDA or OpenCL for programming GPU and MPI at the cluster level. These tools are available, actively supported by equipment manufacturers, and many programs have already been written for them, but there are also disadvantages.

CUDA and OpenCL are extensions of the C language; they are not difficult to learn, although they are fairly low-level tools. With their help, you can relatively quickly implement an algorithm for the GPU, but creating a version optimized for a specific application and configuration turns out to be much more difficult. All optimizations will need to be done manually, which will increase the size of the code and degrade its readability. Although programs created with OpenCL will be portable across a wide range of architectures, performance will not be maintained across such portability. Requires higher level GPU programming tools.

Such tools can be created in different ways: introducing a new programming language; add directives to an existing language, as is done in the PGI Accelerator or CAPS HMPP model; take advantage of extensible languages. Extensible languages- programming languages, the syntax and semantics of which are not fixed, but can be changed depending on the needs of the programmer. Compared to traditional ones, extensible languages ​​have a number of advantages: it is easier to add new features to them; they are open; learning new programming models based on such languages ​​is easier, since only relatively small extensions need to be learned; With the help of such languages, it is easier to fine-tune and optimize programs.

Extensible languages

In order for a language to be extensible, it must contain:

  • an extension mechanism without changing the compiler, equally supported by all compilers, which means, in particular, the presence of a standard interface for interaction with compilers;
  • constructs for extending and manipulating the code tree, such as macros or quasi-quoting, to extend the language;
  • powerful tools for writing extensions, such as the language being extended itself, or another language whose power means that the extension code can do the same thing as any program in that language.

It turns out that there are relatively few languages ​​that satisfy these requirements: Lisp, Nemerle, Seed7, xoc and Stratego. At the same time, xoc, which is intended to extend the C language, uses a separate language Zeta for writing extensions, and Stratego is a domain language for creating source code converters. Nemerle is an extensible language that uses a framework. Net.

All extensible languages ​​support mechanisms for working with the program tree, and most notably this is the construct of quasi-citation - the specification of an object representing the program tree using the source code itself.

The Nemerle language uses a construct for this, for example creating a tree consisting of a variable declaration i with an initial value of 0. Quasi-quoting is similar to creating string objects with string constants. In Fig. 1 shows an example of quasi-citation. The interpolation construct allows variable values ​​to be substituted into a fixed pattern within a quasi-quote. In Nemerle, $(...) constructions are used for this if you need to substitute a list, for example. Extensible languages ​​also contain program tree parsing constructs. In the Nemerle language, the match(...) ( ... ) operator is used for this, an analogue of switch from the C language, the branches of which are quasi-quoting constructs. In this case, interpolation is interpreted as the declaration of new variables, which, if the comparison is successful, receive the values ​​of the corresponding subtrees. For example, for the matching operator match(e) (| => ... ), if e contains a tree, it will go into the variable a and into the variable b .

Tools for working with the program tree are used in language extension constructs. In the Nemerle language, these are macros - special functions executed at the compilation stage and returning a fragment of the program tree, which is substituted in place of their call. In this case, the macro accepts program fragments as parameters and can transform them. In principle, you can call a macro in the same way as a regular function; but a more interesting feature is to bind the macro call to a special syntax. This allows you to introduce new syntactic structures into the Nemerle language and thus expand the language.

In Fig. Figure 2 shows an example of a macro with a syntactic extension that allows you to declare a multidimensional loop with variables and the number of iterations for each dimension, and in Fig. Figure 3 gives an example of the program transformation that this macro performs. Note that the macro that implements this extension takes up less than 30 lines of source code and includes several error checks. With the traditional approach, implementing such an extension would require significantly more code and, in addition, would require studying the internal workings of the compiler.

Historically, the macro mechanism was the first to appear in Lisp, in which the program is represented as a regular list and does not require special constructs for working with the program tree, therefore it is in this language that extensible programming has become most widespread. Macros in Nemerle are similar to those in Lisp. In the xoc system, the extension mechanism is implemented through grammar extensions and parse tree attributes. Any extension necessarily specifies two attributes: the type of syntactic structure and the expression in the base language into which it is converted.

Extensible languages ​​are characterized by the implementation of many standard constructs through macros. In the Nemerle language, all loops and conditional operators, except match, are implemented through macros, and in Lisp, macros are standard loop constructs and function declarations.

How to use languages?

For an extensible programming language, you can write constructs that allow you to program GPUs in the most convenient way, which was done as part of the NUDA (Nemerle Unified Device Architecture) project, the goal of which is to create extensions of the Nemerle language for GPU programming. OpenCL is used as the interface for interacting with the GPU and the target language for presenting the program.

First, we need to implement execution on the GPU of a subset of code in the Nemerle language. At the same time, familiar language operators such as loops and branching, as well as working with simple data types, structures and arrays, should be supported. The code for the GPU is placed in separate functions, or in NUDA kernels. Each kernel is marked with a nukernel macro, which, based on the kernel code, generates OpenCL code and a stub method for calling the kernel on the host side. Before code generation, all macros are expanded, with the exception of looping and branching macros. If a function needs to be called within the kernel, the function must be marked with a nucode macro, which will generate OpenCL code for the function. The kernel is called using the nucall macro; In addition to the kernel parameters, it is also given the configuration of the thread grid with which it starts.

Most often, the body of the loop is used as the kernel for the GPU, so I would like to immediately transfer the loop to the GPU. This can be implemented in Nemerle - the corresponding macro in NUDA is called nuwork. It takes the thread block size as required parameters and, based on the current context and analysis of the loop body code, determines a set of variables that must be passed to the kernel as parameters. The body of the kernel is formed from the body of the loop, the calculation of loop indices through the global thread number, as well as a condition that allows the loop to be executed correctly even when the global grid size is not divisible by the size of the thread group. The loop is replaced by a call to the nucall macro, which calls the generated kernel.

In principle, it is possible to allow the use of regular Nemerle language arrays in GPU programs, but this leads to high overhead - the array must be copied to GPU memory every time the kernel is called, and then copied back. Therefore, GPU programs use special array types with lazy synchronization between the GPU and CPU. This allows, on the one hand, not to clutter up the program text with commands for copying data, and on the other, to avoid overhead costs for copying data. For such arrays, as for regular arrays in Nemerle, memory management is used using garbage collection. To allocate memory for such arrays, there is a macro nunew, which must be applied to the usual memory allocation operator.

In Fig. 4 on the left is a regular array addition program, and on the right is a similar program, but performing calculations on the GPU. It is quite simple to obtain GPU programs from regular ones - you only need to apply macros to loops and memory allocation operations, while the amount of code remains practically unchanged. A program written using NUDA takes less than 20 lines of code. A similar program, but in pure C and OpenCL takes more than 100 lines.

In addition to macros that make working with the GPU easier, the NUDA extension system also includes annotations for loop conversion. Annotations are essentially special macros. For example, the inline annotation is applied to a loop with a fixed number of iterations and unrolls it completely. The dmine annotation performs deep loop unrolling. “Deep unrolling” means that creating multiple copies of the loop body and shuffling is performed not only for the loop itself, but also for nested loops if they are independent.

Effect

Why does a programmer need to learn a new language and master new libraries of extensible languages? The main answer is productivity. Having an algorithm of parallel loops working with arrays and written in the Nemerle language, it is enough to add a few annotations to get a program for the GPU. In this case, the program will run on any device that supports OpenCL, including nVidia and AMD GPUs, as well as x86 processors. To achieve the same thing using OpenCL or CUDA technologies alone, you will need to spend significantly more resources, which will be spent not only on writing source code, but also on debugging the interaction between the host and the GPU.

Another reason is the performance of the generated code. On CUDA or OpenCL, loop conversions will need to be done manually, and separately for each architecture. This is a long and error-prone process, and the resulting code is difficult to read and unmaintainable. With NUDA, this work can be done using annotations. For example, for several kernels, you can optimize the operation of image convolution or matrix multiplication using inline and dmine annotations. Without increasing the size of the source code, you can achieve performance gains of two to five times. Moreover, if the same transformations were performed manually, this would lead to an increase in the code by several times, and sometimes by an order of magnitude, not to mention the time spent on debugging and selecting optimal scan parameters. For example, a universal seven-line annotated program in NUDA for double-precision transposed matrix-matrix multiplication runs on an nVidia Tesla C2050 only 40% slower than the currently fastest implementation (CUBLAS 3.2). A similar program written by hand would take 70 lines of code. Naturally, for standard tasks you can manually write the code once to increase productivity, but for specific tasks, reducing labor costs and increasing productivity will be very useful. Finally, productivity gains also apply to the creation of extensions themselves: it is easier to create them using extensible languages ​​than using traditional tools. The entire NUDA system, despite its functionality, takes only 12 thousand lines of code, not counting tests. This is relatively little; for example, the Nemerle language compiler (build 9025) takes about 130 thousand lines.

The extensible language is a powerful tool, and its use in parallel computing is still in its infancy. There are many interesting problems in the development of parallel programming languages, and any of them can be solved using a combination of extensions and libraries. You can add asynchronous code blocks and parallel loops to the language, and you can create convenient constructs for programming cluster systems, such as distributed arrays. Finally, you can use extensions to build a full-fledged parallel programming language, such as Chapel or X10.

Andrey Adinets([email protected]) - junior researcher Research Computer Center of Moscow State University (Moscow).



In addition to using comments to obtain a parallel program, they often go to extend existing programming languages. Additional operators and new elements for describing variables are introduced, allowing the user to explicitly define the parallel structure of the program and, in some cases, control the execution of the parallel program. Thus, the High Performance Fortran (HPF) language, in addition to traditional Fortran operators and the special comment system, contains a new FORALL operator, introduced to describe parallel program loops. The most interesting feature of HPF is the multi-level mapping array - template array - virtual processor array - physical processors, which allows the most flexible mapping of user data to a real computer.

Another example is the mpC language, developed at the Institute of System Programming of the Russian Academy of Sciences as an extension of ANSI C. The main purpose of mpC is the creation of efficient parallel programs for heterogeneous computing systems. The user can specify the network topology, data and computation distribution, and required data transfers. Message sending is organized using the MPI interface.

The DVM system is designed to create portable and efficient computing applications in the C-DVM and Fortran-DVM languages ​​for parallel computers with different architectures. The abbreviation DVM corresponds to two concepts: Distributed Virtual Memory and Distributed Virtual Machine. The first reflects the presence of a single address space. The second reflects the use of virtual machines for a two-stage scheme for mapping data and calculations to a real parallel machine. The programming model involves specifying DVM instructions using special comments, which means one version of the program for sequential and parallel execution. Three groups of directives are supported: data distribution directives, computation distribution directives, and remote data specifications. The compiler translates the program into Fortran or C language, using one of the existing parallel programming technologies (MPI, PVM, Router) to organize interprocessor interaction. The DVM system also includes the LIB-DVM support library, a DVM debugger, a DVM program execution predictor, and a DVM program performance analyzer. The system was developed at the Institute of Applied Mathematics named after. M.V.Keldysh RAS.



Special programming languages

If it is necessary to more accurately reflect either the specifics of the architecture of parallel systems, or the properties of a certain class of problems in a certain subject area, then special parallel programming languages ​​are used. The Occam language was created for programming transputer systems, and the single-assignment language Sisal was designed for programming stream machines. A very interesting and original development is the declarative language NORM, created under the leadership of I.B. Zadykhailo at the Institute of Applied Mathematics named after. M.V.Keldysh RAS to describe the solution of computational problems using grid methods. The high level of abstraction of the language allows you to describe problems in a notation close to the original formulation of the problem by a mathematician, which the authors of the language conventionally call programming without a programmer. A single-assignment language does not contain traditional programming language constructs that fix the order of calculation and thereby hide the natural parallelism of the algorithm.

Libraries and interfaces that support interaction between parallel processes

With the advent of massively parallel computers, libraries and interfaces that support the interaction of parallel processes have become widespread. A typical representative of this direction is the Message Passing Interface (MPI), the implementation of which is available on almost every parallel platform, ranging from vector-pipeline supercomputers to clusters and networks of personal computers. The programmer himself explicitly determines which parallel application processes in which place of the program and with which processes should either exchange data or synchronize their work. Usually the address spaces of parallel processes are different. In particular, MPI and PVM follow this ideology. Other technologies, such as Shmem, allow the use of both local (private) variables and shared (shared) variables that are accessible to all application processes, and implement a scheme for working with shared memory using Put/Get operations.

The Linda system stands somewhat apart, adding only four additional functions in, out, read and eval to any sequential language, which allows you to create parallel programs. Unfortunately, the simplicity of the underlying idea turns into big problems in implementation, which makes this beautiful technology more of an object of academic interest than a practical tool.

Parallel subject libraries

Often in practice, application programmers do not use any explicit parallel constructs at all, turning to subroutines and functions of parallel subject libraries in time-critical fragments. All parallelism and all optimization are hidden in calls, and the user can only write the external part of his program and competently use standard blocks. Examples of such libraries are Lapack, ScaLapack, Cray Scientific Library, HP Mathematical Library, PETSc and many others.

Some parallel subject libraries

BLAS and LAPACK are libraries that implement basic linear algebra operations, such as matrix multiplication, matrix-vector multiplication, etc.

ScaLAPACK includes a subset of LAPACK procedures redesigned for use on MPP computers, including: solving systems of linear equations, matrix inversion, orthogonal transformations, eigenvalue searches, etc.

FFTW, DFFTPack - fast Fourier transform.

PETSc is a set of procedures and data structures for parallel solving scientific problems with models described in the form of partial differential equations.

Specialized packages and software systems

And finally, the last area that is worth mentioning is the use of specialized packages and software systems. Typically, in this case the user does not have to program at all. The main task is to correctly specify all the necessary input data and correctly use the functionality of the package. Thus, many chemists use the GAMESS package to perform quantum chemical calculations on parallel computers, without thinking about how parallel data processing is implemented in the package itself.

Course work

on the topic: “Programming languages”


Introduction

1. Programming languages

1.1 History of the development of programming languages

2. Review of modern programming languages

2.1 C its varieties

2.2 Pascal

2.3 Fortran

2.4 BASIC

Conclusions and offers

List of used literature

Introduction

At the present stage of development of computer technology, it is impossible to imagine any highly qualified specialist who does not know information technology. Since the activity of any subject largely depends on the degree of knowledge of information, as well as the ability to use it effectively. For free orientation in information flows, a modern specialist of any profile must be able to receive, process and use information, primarily with the help of computers, as well as telecommunications and other new means of communication, including the ability to handle programming languages.

The relevance of this topic is due to the fact that the progress of computer technology has determined the process of the emergence of new and diverse sign systems for recording algorithms - programming languages.

The object of the study was programming languages ​​and the history of the development of programming languages.

The purpose of the course work is to study the classification of programming languages ​​and their development.

Research objectives:

1. View general information and levels of programming languages.

2. View the history of the development of programming languages.

3. Review modern programming languages.

Research objectives:

1. Introduction to programming languages.

2. Consideration of the history of the development of programming languages.

3. Review of modern programming languages.

The first chapter discusses general information about programming languages ​​and the history of their development.

The second chapter provides an overview of modern programming languages.

This course work used research methods.

Technical means used: PC: Core 2 DuoE6600 2.4 GHz 2 x 4 MB L2; 2 x 1024 MB DDR3-1333 MHz; NVIDIAGeForce 8600 GT 512 MB; HDDHitachiDeskstar 7K1000 1TB; Printer: Canon LBP3010.

Windows OS software XPProfessionalSP3. This course work was completed in Microsoft Word 2003, and other programs were also used: Microsoft PowerPoint, Nero StartSmart.

1. Programming languages

A programming language is a notation system used to accurately describe computer programs or algorithms. Programming languages ​​are artificial languages. They differ from natural languages ​​in the limited number of “words” and very strict rules for writing commands (operators). Therefore, when used for their intended purpose, they do not allow for the free interpretation of expressions characteristic of natural language.

It is possible to formulate a number of requirements for programming languages ​​and classify languages ​​according to their features.

Basic requirements for programming languages:

clarity - the use in the language, if possible, of already existing symbols that are well known and understandable to both programmers and computer users;

unity - the use of the same symbols to denote the same or related concepts in different parts of the algorithm. The number of these characters should be as minimal as possible;

flexibility - the possibility of a relatively convenient, uncomplicated description of common methods of mathematical calculations using the limited set of visual means available in the language;

modularity - the ability to describe complex algorithms in the form of a set of simple modules that can be compiled separately and used in various complex algorithms;

unambiguity - unambiguous recording of any algorithm. Its absence could lead to incorrect answers when solving problems.

Currently, there are several hundred actually used programming languages ​​in the world. Each has its own area of ​​application.

Any algorithm is a sequence of instructions, following which you can move from the initial data to the result in a finite number of steps. Depending on the degree of detail of the instructions, the level of the programming language is usually determined - the less detail, the higher the level of the language.

Based on this criterion, the following levels of programming languages ​​can be distinguished:

· machine;

· machine-oriented (assemblers);

· machine-independent (high-level languages).

Machine languages ​​and machine-oriented languages ​​are low-level languages ​​that require specifying fine details of the data processing process. High-level languages, on the other hand, imitate natural languages ​​by using some spoken language words and common mathematical symbols. These languages ​​are more human-friendly.

Different types of processors have different instruction sets. If a programming language is focused on a specific type of processor and takes into account its features, then it is called a low-level programming language. In this case, “low level” does not mean “bad”. This means that the language operators are close to machine code and are focused on specific processor commands.

When programming in machine language, the programmer can control every instruction and every memory cell and use all the capabilities of available machine operations. But the process of writing a program in machine language is very time-consuming and tedious. The program turns out to be cumbersome, difficult to view, and difficult to debug, change, and develop.

Therefore, in the case when it is necessary to have an effective program that takes into account the specifics of a particular computer to the maximum extent, instead of machine languages, machine-oriented languages ​​(assemblers) that are close to them are used.

Assembly language is a low-level machine-dependent language in which short mnemonic names correspond to individual machine instructions. Used to represent programs written in machine code in human-readable form.

Assembly language allows the programmer to use text mnemonic (that is, easily memorized by a person) codes, assign symbolic names to computer and memory registers at his discretion, and also set addressing methods that are convenient for himself. In addition, it allows you to use different number systems (for example, decimal or hexadecimal) to represent numeric constants, use comments in the program, etc.

Low-level languages ​​create very efficient and compact programs because the developer has access to all the capabilities of the processor. On the other hand, it requires a very good understanding of the computer, makes it difficult to debug large applications, and the final program cannot be transferred to a computer with a different type of processor. Such languages ​​are usually used to write small system applications, device drivers, and interface modules with non-standard equipment, when compactness, performance, and the ability to directly access hardware resources become the most important requirements. In some areas, such as computer graphics, libraries are written in assembly language to efficiently implement computationally intensive image processing algorithms.

Thus, programs written in assembly language require significantly less memory and execution time. A programmer's knowledge of assembly language and machine code gives him an understanding of the machine's architecture. Although most software professionals develop programs in high-level languages, the most powerful and efficient software is written entirely or partially in assembly language.

High-level languages ​​were developed in order to free the programmer from taking into account the technical features of specific computers and their architecture. The level of language is characterized by the degree of its closeness to natural, human language. Machine language is not similar to human language; it is extremely poor in its visual means. The means of writing programs in high-level languages ​​are more expressive and familiar to humans. For example, a calculation algorithm using a complex formula is not divided into separate operations, but is written compactly in the form of a single expression using familiar mathematical symbols. It is much easier to create your own or understand someone else’s program in this language.

An important advantage of high-level languages ​​is their universality and independence from computers. A program written in such a language can be executed on different machines. The program compiler does not need to know the command system of the computer on which he intends to carry out calculations. When moving to another computer, the program does not require modification. Such languages ​​are not only a means of communication between a person and a machine, but also between people. A program written in a high-level language can be easily understood by any specialist who knows the language and the nature of the task.

Thus, we can formulate the main advantages of high-level languages ​​over machine languages:

The high-level language alphabet is much wider than the machine language alphabet, which significantly increases the clarity of the program text;

the set of operations allowed for use does not depend on the set of machine operations, but is chosen for reasons of convenience in formulating algorithms for solving problems of a certain class;

the sentence format is quite flexible and convenient to use, which allows you to specify a fairly meaningful stage of data processing using one sentence;

the required operations are specified using generally accepted mathematical notations;

Zalina January 13, 2016 at 03:42 pm

Different programming languages ​​and their areas of application. Lecture in Yandex

  • Yandex company blog,
  • Website development,
  • Programming,
  • Industrial programming

We decided to devote our first post this year to a very basic topic, a lecture on which was given at the Small ShAD. It is attended by high school students who are interested in technology, hence the specificity of the presentation - the lecture will be especially interesting to those who are just starting to program and are thinking about what direction to develop. For them, Yandex has a course “Introduction to Programming (C++)”, which can be taken on the Stepic.org platform.

Lecturer Mikhail Gustokashin is the curator of academic programs at Yandex, director of the center for student competitions at the Faculty of Computer Science at the Higher School of Economics. Mikhail has trained dozens of winners and prize-winners of the All-Russian Programming Olympiads.

The lecture talks about what programming languages ​​there are, how they differ, how they appeared, and which ones are better and which ones are worse. At the beginning, we will talk a little about the history of languages ​​- how they appeared, how people began to program, how everything developed, what is happening now. The second part will touch on what tasks which language is suitable for, how to “choose your favorite language and enjoy life.” The lecturer will also talk a little about how, in his opinion, you can learn all this and then get a job.

As always, below the cut is a detailed transcript of the lecture so that you can navigate its contents.

History of programming languages

Let's start from the beginning. In the beginning, computers didn't even have keyboards! That is, everything was very bad - they had neither a keyboard nor a screen, they only had punch cards (these are little things with holes or no holes). Accordingly, either they stuck the pins there, or they shone a light there. If there is a hole (or vice versa, not) - this meant a zero or a one. And programs at that time were written using machine codes - every operation on a computer (addition, subtraction, some more complex operations) had some kind of machine code. People themselves chose this code from a sign, all sorts of addresses in memory, they knocked it all out with their hands and put it into the reader - and it was all counted. Of course, the work of a programmer was probably not particularly interesting then - making holes - and with the development of science and technology, of course, they began to come up with all sorts of more “interesting” things. For example, assembler, which already made life somewhat easier.

Well, how did he make life easier? Instead of remembering that there was some kind of “magic” code for the command, all sorts of words were used that were similar to “human” English - some add or mov - and then registers or memory areas, variables with which these were needed were listed perform operations. But it’s clear that this, in general, also required quite a lot of mental effort to keep in our heads in which register we have what, where what variables are, and what is happening in general. Why did this happen? Because computers were “stupid” and could not understand anything more “smart”. In fact, assembling machine code from assembler also requires time and memory (at that time, of course, there was little of it).

Gradually, it became clear that developing such large complex programs was very difficult. The programmer's productivity in these teams was extremely low - that is, he wrote several lines a day (meaningful), and each line did not do anything special - some simple arithmetic operations. And people wanted to make languages ​​much more similar to human language, to English in particular, to make writing programs easier and more convenient. And off we go!

Old and dead languages

One of the first languages ​​was Fortran. By the way, it was also punched out on punched cards - there were special punched cards for punching out Fortran programs. But if you take this Fortran now, in my opinion, it is even somewhere between 50-60. appeared - and if you try to write something on it, you will be very unpleasant, I guarantee you! Modern Fortran is still alive, but is quite different from what it was before.

Other languages ​​- now I’ll write one thing, which you’ve probably heard of only at various events where they talk about the history of programming - this is COBOL. It was a language for writing business applications. What are business applications? Some transactions in banks, something else, all of this was written in Cobol. Of course, it’s not very popular here. I think you will find it very difficult to find a Cobol programmer in Moscow. And somewhere not in Moscow - with even greater difficulty. But, surprisingly, just 10 years ago, more than half of all the code written by humanity was written in Cobol. And to this day, a significant part of all banking transactions are carried out using programs written in it (COBOL), and people still write something in it.

There is also a “funny” language, it was called Algol (the 68th version, which characterizes the year of its creation). This is an algorithmic language. In general, they were able to do something there, but now we are not very interested in what they can do. And with this we can finish our excursion into antiquity and into relatively unused languages ​​and move on to what is still alive (and actively living).

Old but living languages

Algol was invented in Europe, and Fortran was used mainly in the States - there are no big differences. What trend is noticeable? At first everything was complicated and in order to write you had to be almost an engineer, an electrical engineer, to understand where which contacts are connected and something else for programming. Then you also had to sit with the pieces of paper and count the memory, look after it. And gradually everything became simpler, simpler, simpler and then even simpler for the programmer - to think as little as possible for a person, to do as much as possible automatically. Around the end of this period (the lecturer points to Algol and Kobol), languages ​​begin to appear that, in a sense, have “survived” to this day.

BASIC. Perhaps some people still write something in it, at least I saw that in some institutions they teach in QBasic - there’s a blue window where “1989” is written. In general, he is “living with all his might”! It was invented as a language for non-programmers. At that time, a programmer was such a very specialized profession. And here they tell you: “Here we have a cool Basic language, and any reasonable person can write a program in it - it’s easy.” Again, that BASIC and modern BASIC are a huge difference. All these lines numbered after 10, all sorts of GOTOs and other horrors - they no longer have anything to do with modern BASIC, and even to BASIC of 1989 they have little to do with it.

Another funny story is the Pascal language, widely known in university circles, mainly in Russia and the countries of the former Soviet Union. It has been and continues to be used surprisingly as a teaching language. In the rest of the world it is less common, but it is also alive and well. There is such a person as Wirth - he is a scientist, a theorist. He participated in the Algol discussion, he did not like what happened, and he came up with his own language - Pascal. And then the Borland company (and before that many other companies - Apple was involved, in particular) took it and ruined everything. He had a beautiful, coherent theory - “everything will be fine” - and they took it and stuffed it with what people needed to work. Well, it didn’t turn out as beautiful as he wanted.

And finally... C was invented by engineers. If Pascal was invented by a scientist, then C was invented by Kernighan and Ritchie, they worked as engineers at Bell. How did this happen? At that time, it was impossible to write anything systemic in these languages ​​(the lecturer points to Fortran, COBOL, Algol). What is “systemic”? For example, an operating system, some drivers, something else. These languages ​​were intended for mathematical calculations, for business calculations, for all that. And everything else was written in Assembly language. There were some languages, they are now dead, that is, the C language did not appear immediately from Assembly, but through some intermediate things.

What's the point? Kernighan and Ritchie loved to play the Asteroids toy - a spaceship flies, and there are asteroids, he shoots at them, and they fall apart. They had a server where they played, but there were a lot of people there, and the toy was slow. And they discovered somewhere in their office that they had some kind of computer that no one was using. But there was a problem - it was of a different architecture, and the game was written in Assembly.

They rewrote it, of course, even added some features to play on it. But this led them to the idea that rewriting for a new architecture every time is not very smart. And they decided to write a high-level language that would be suitable for system programming, that is, in which it would be possible to manage memory, in which it would be possible to understand where things lie and how to access these pieces of memory. And so the C language appeared, which had a huge influence on everything that followed. All of them (the lecturer points to Algol, Fortran and other languages ​​mentioned) had a great influence, but C - just yes...

Accordingly, it was the main language in Unix, an operating system that was even more popular at that time than it is now. And around the 80s, the situation was something like this (the lecturer shows Basic, C and other mentioned languages). Let's say that all this has already slowly died out in our country (the lecturer erases mentions of Assembly Language, Fortran and Algol)... And in the 80s, computers became smaller, smarter, cheaper, and people wanted all sorts of strange things to make life even better, to live even more fun.

Languages ​​from the 80s

One of the first oddities was that it was a C++ language. The C language has a huge number of shortcomings (well, just generally huge) - you can do everything in it, including shooting yourself in the foot, shooting yourself in the foot with fiction, in the other foot, shooting one foot in the other foot, in general - what whatever you want to do. But at the same time, some architectural things are done there quite difficult - again, as in Assembly, we have to keep track of where we are, what and what memory we have allocated; It’s there all the time “flowing” somewhere, this memory - that is, we allocated it, forgot to delete it, deleted the wrong thing, went beyond the memory limits, in general - we raked in a bunch of problems.

C++ was originally created as a set of additions to the C language that would make development easier. At that time, object-oriented programming became fashionable and people decided that everything could be described in the form of a hierarchy, that is, you have a ball (abstract), you inherit from it a soccer ball, a volleyball, another abstract ball. It was fashionable then that “we are now writing everything in the form of some kind of hierarchy, and everything will be fine, life will get better, everything will be fine and that’s it.” C++, in a sense, implemented this object-based approach - it was not the first object-oriented programming language, but it became quite popular and all sorts of features began to appear in it. At the same time, C++ retained almost full compatibility (at that time) with the C language; a program written in C was successfully compiled as C++ in 99% of cases and even worked the same way. This was intended to make it easy to switch from C to C++.

In addition to the object approach (in C++), a standard template library (STL) quickly appeared. I think that at school, those who were still learning Pascal discovered that, firstly, you don’t have built-in sorting (in the ancient, blue Borland Pascal, now it is already in modern versions) - there is an example (source code) sorting, it can be copied and pasted. But if you want to sort integers here, real numbers here, and strings here that can be compared with each other, you had to write three different sorts that do exactly the same thing, they just have different data types. This is not very good, and the templates that did not immediately appear in C++ greatly alleviated this problem. That is, you had an abstract program that successfully sorted something that could be compared with each other.

Scripting languages ​​from the 90s

But time did not stand still; in the 80s, a lot of interesting things happened. But somewhere around the turn of the 80s and 90s, computers became so good that it was possible to do very strange and very inefficient things. In particular, these were scripting languages ​​that were not compiled into machine code, but rather interpreted. BASIC was also interpreted at some time, but these scripting languages ​​were intended mainly for text processing - these are, for example, Perl, Python (it was not very famous then), PHP, Ruby - these are the scripting languages ​​that in one or another to a different extent, they still live (they all managed to appear before 2000, even much earlier).

Let's go over them a little, because these are specific things and are now used in many places. What is the idea? If we don't compile, then we can allow a lot more. For example, a program can look at its code and somehow use it; she knows what is happening in her and due to this she can do a lot of interesting things.

Perl was intended for text processing - in those days there was so much memory in computers that you could stuff some text there and do something useful with this text (for example, count words, do some kind of search). But, in my opinion, it was designed by people who were a little crazy, because there is a joke about it: “Any set of characters written is a valid Perl program.” In my opinion, you can only write on it, you cannot read it. When I look at Perl code and try to understand something, I don't understand anything. Maybe if I knew him better, I would understand something, but as I heard from those people who still know how, they say that it’s easier to rewrite it again. That is, the programs turn out to be short and it’s really easier to rewrite them from scratch than to figure out what’s there and fix it.

Around that time, in the mid-90s, the Internet appeared. At first it was mail, websites with static HTML, but people wanted to add some kind of dynamics there, so that everything would happen dynamically, some forms could be filled out, guest books could be made, and something else. Accordingly, this required some kind of interaction, they came up with a protocol, how it interacts, and, most importantly, the generation of these static (conditionally) pages that will be “spitted out” to the user in response to his request.

In general, nothing other than Pearl was suitable at that time. Writing a handler in pure C or C++ was a bad idea. And for lack of anything better, at that time (and for quite a long time) Pearl was the popular language for web development. Of course, the scale cannot be compared with what is happening now.

PHP appeared as... by accident. One person stopped doing this quite quickly - he made his own page, he had some kind of guest book, something else, some other things. And he wrote a set of some macros for Perl that were similar to C, because he knew how to use C, simply because it was so convenient for him. And I called it Personal HomePage. He shared it and said: “People, look at what I wrote, everything here is much clearer than in Perl and you can edit it.” And people liked it.

Then he gave up this business. In general, as a result, this PHP began to live and became over time much more popular than Perl. But this “birth trauma” of his (conceived as a set of macros for Pearl) played quite a cruel joke on him. The language turned out strange. That is, it developed on its own, no one designed it, no one administered the development process (neither a company nor any person), but there were many groups, each of which sawed what they liked. As a result, the functions are named differently, there’s not even a style, everything is underscored, basically haphazard, the settings are here and there, and how all this will work is not very clear. But you can sit down and write in PHP in two hours, because that’s how it was intended.

Python and Ruby: Ruby is less popular now, Python is somehow better “planed”, let’s talk about it later. It is clear that in those days these were (the lecturer points to Perl, Python, Ruby, PHP) highly specialized languages ​​for highly specialized purposes. In general, no one wrote any system programming, no business logic in them at that time and now not much does it.

Compiled languages ​​from the 90s

We will go around the same times, but in the other direction. At that time, we used C++ for almost everything that needed to be written, not for the web, not for text processing, but for just applications, for operating systems, for toys - in general, for anything. But C++ is actually a terrible language. Why? Because, firstly, it inherited all C problems due to backward compatibility. There you could still kill yourself in a million different ways, the same ones that were in C (naturally, new ways were added in C++). At the same time, if you write everything well and correctly, as was intended by the authors of C++, then, of course, it was no longer possible to kill yourself using the old C code methods, and it seems like there are fewer of them. However, it had a very strange, peculiar object model. Splitting a program into modules, into pieces of some kind, generally came from C (if you know how to write include in C or C++ - in fact, it was intended as a way to simply insert the library text into your program, in the end, when you write a bunch of includes, you have everything - if it’s “primitive”, as it was at the very beginning - everything is inserted into one file and then it all takes a terribly long time to compile, because the same Pascal, Virtovsky, was much more thoughtful in this regard, the later ones. versions have become even better.

In general, C++ has a lot of disadvantages. The programmer had to be highly qualified to write in C++, and such programmers were expensive (and training, and something else, that is, it’s difficult to find programmers on the market, they need to be paid a lot, and in general this is not the point... ). And our computers count faster and faster, they become cheaper, people buy new computers and want more applications, more toys for their phones, in general - more joy.

This is how Java appeared. There is also a rather funny story about how this language got its name. There are programmers there, they drink coffee all the time and at that time it was fashionable to drink coffee, which grew on the island of Java. The language was conceived as a language for built-in devices, in particular for a coffee machine. This is how the name came about...
What started with her, what was good about her and why did she gain so much popularity? First, they got rid of Sishnoi's legacy, completely. There are no signs, much fewer ways to shoot off some part of your body and break everything. Secondly, they introduced much more recent ideas in terms of the object model - that is, C++ appeared much earlier than Java and used a more archaic, “wild” object model. Well, here (the lecturer points to Java) it was already more thought out then, and in theory people thought, and in practice they applied and made everything much cooler.

And finally, third. Our Java programs were compiled not into machine code, but into code for a virtual machine. That is, you had a virtual machine (VM) JVM - Java. Your programs were assembled into some kind of intermediate representation and then, with the help of this machine, they were already executed. What did it give? Firstly, it slowed down, secondly, it ate up memory with terrible force, thirdly, it was portable anywhere (theoretically) - even to a coffee maker, even to a coffee grinder, even to a computer, even to a mobile phone. On the one hand, this is good, that is, you just wrote an implementation of a virtual machine, then you run your Java programs everywhere. But, on the other hand, it’s bad that the same phone then had little memory, low performance, and all this also began to slow down and slow down.

But this is not even the main thing for which the language was invented in the first place. The Java language was invented to reduce the qualification requirements for programmers. That is, worse programmers can write good programs in Java, because it does not allow you to write bad programs - there is no means there to write bad programs. There you can only write good programs. Well, in the understanding of the creators of the language.

That is, if in C, in C++, in Python, in anything, we can create some kind of terrible garbage dump out of our project, where we have everything mixed up, assembled for hours, and something else. In Java, you can also create a garbage dump, but for this you need to make some effort. That is, by default, it’s not a “garbage dump”, other problems arise, that something has been inherited and inherited - in general, for one meaningful line, there are ten not very meaningful ones. But, such a moderately qualified programmer can write fairly high-quality code.
We're almost at the end. For us, the next thing that appeared was .Net (dotnet), and in particular we are interested in C# (almost the same thing [the lecturer points to Java], that is, there are differences in details, if you choose between them, look where they pay more money).

And one more thing - JavaScript. Has nothing to do with the Java language, appeared in the same year - the word was fashionable, they licensed the trademark to use it.

What is the main thing you need to pay attention to? (The lecturer draws arrows from C++ to Java, .Net, C#, JavaScript and PHP). To write a simple program in one of these languages, and in many others - if you know C++, you generally don’t need to know anything else - you write in C++, and then add dollars at the beginning, something else do little things and it starts working on anything (the lecturer points to the languages ​​to which the arrows from C++ were assigned). That is, they are extremely similar in some simple things. If you are solving some school problems, educational problems, or something else (you are not designing a large project - you have one file that reads numbers, displays numbers in the console, and does something else), then there is almost no difference between these languages. It is clear that JavaScript and PHP are specialized, everything is a little different for them. But here (the lecturer points to Java and C#) there is very little difference at all.

Since then, all sorts of other interesting things have appeared, but it is not clear whether they will live or die successfully. What are they using now, for what purposes?

Selecting a language depending on the task

Let's say you are faced with the task of writing a driver for a video card. What language will you use today? (Shout from the audience: Java!) Why... Java is great, but why not Ruby or PHP? (The lecturer speaks sarcastically.)

Low Level Programming

If you are writing something low-level, then the best choice is C, but actually I have heard (but not seen) that C++ is used for this. But I have little faith in this, because in C you can clearly control - since you gave so many bytes of memory, that means there will be so many. And in C++ (STL) how is a string implemented? Well, somehow it was implemented. And in the end we don’t know how and what is happening there; maybe we will run out of memory on our video card or something else will happen. Therefore, C still lives and does not die, such system programming tasks still exist - write an operating system, write drivers, write something else - C is great for this. In addition, now all sorts of devices are appearing (the Internet of Things is promised to come soon) that run on batteries (and, naturally, there will be millions of them, everything will be covered with this Internet of Things), they should be very cheap and have very little electricity consume. Accordingly, there will be 2 KB of memory, a 5 kHz processor, and it’s clear that it won’t be possible to screw in some kind of virtual machine or scripting language in the near future - which means you’ll have to write something in C. And even now, for example, computing on a video card (OpenCL or some other technology) - they don’t come up with a new language to write programs for them - they do C with some big restrictions. Just because people already know how, why learn something new? Formally, this is probably also, in a sense, C.

Web programming

Let's say you want to write a new Facebook (social network). What will you write this on? (People from the audience are talking about HTML and CSS.) HTML and CSS are design, and we want it to be possible to add photos, friends, and leave comments there.

For the scripting part - that is, what will happen on the client side - this is JavaScript. Moreover, sometimes JavaScript is generated in another language and sent (it happens that the script is generated... because it is sometimes easier to process some changes in the logic).

Surprisingly, it is written in PHP - and Facebook, and many other large projects. Of course, they had to write some of their own things so that it would still work normally, and not in a “clunky” way, but they did it. In principle, it more or less doesn’t matter what you write in, but I don’t recommend Perl. Here and now, of course, no one writes anything for the web from scratch. Everyone is writing some kind of framework or something else. Online store? We downloaded a framework for an online store - and that’s it, we wrote an online store.

Programming for business

Next you want to write some boring application for a bank. Or, for example, do you have anyone who sells SIM cards? Perhaps you have ever bought a phone or something else and been told: “The system is hanging, we can’t do anything.” What will you use to write such an application? (Shout from the audience about Python) You can’t write this in Python, what are you saying?! There is no need to write anything for business in Python. Why? Because when you write something in Python, it is impossible to detect a significant number of bugs during the writing process. Python is dynamically typed in every possible way, and in general you can hide a bug in such a way that it will pop up in such a situation that you won’t even be able to understand what these crooked users did there, that everything is broken for you. That is, in Python it is better to write small scripts for yourself - you understand what is happening there and what is being done. Well, or something that you don’t mind throwing away: you want to roll out something before your competitors, so what if it breaks every now and then. You wrote in Python and that's it - you captured the market. And if you write something for a long time, for example, some kind of banking application (so that it approves loans, something else) - you write it in Java. Because it’s a serious matter, papers, money, documents, something else, but you can’t screw it up so much that everything breaks, otherwise people will be offended - their money went away and didn’t get anywhere, because in some kind of moment the string turned into a number or vice versa. So, it means that you methodically take it in Java and write, write... Well, or on .Net, such situations, in principle, also happen. There, of course, you can also run into problems, but still the likelihood of this is somewhat lower.

Programming for the army, aerospace industry

Now imagine that they decided to send you to the Moon on a rocket. What would you rather be used to write the code that controls the rocket engines? Let's get a look. This, probably (the lecturer shows Perl, Python, PHP, Ruby), is not worth it - it slows down, something else is happening, and in general I would not agree to fly on such a rocket. In C++? To be honest, I wouldn’t trust it either, because in C++ there are too many ways to kill yourself. When you're out there somewhere in space, it's not very good.

Maybe in Java? It seems that everything there is quite reliable and the architecture is good, no wild types, no unnecessary trips beyond memory limits. Let's say the most crucial moment has come, and our Java has decided to collect garbage for us. We need to land, slow down, and she’s like: “No, garbage is going.” In general, not very good either.

Honestly, I would prefer if this program was written in Pascal. Of course, I don’t really like Pascal, but somehow in such matters it would be very cool.

Using multiple languages ​​for software development

Well, what needs to be said in general about modern languages. Now many projects do not live in any one language, that is, some of them live in one language, some in another, and some in a third. For example, if you have some kind of web application that processes wild amounts of information, calls to disks (not even to databases, they are so huge that even a database there cannot handle any already written one) are probably written in some kind of then low-level C, to write wildly quickly to disk and all that. Naturally, it’s not worth writing the entire project in C. Maybe there is some kind of intermediate logic written in Java that calls C functions for quick calls. Well, the frontend (what the user looks at), of course, is already written in something, in some scripts, in something that is directly executed by the browser (JavaScript). And all this lives together and interacts successfully.

When developing some applications, even large ones, sometimes what do people do? They take it and write a prototype in Python (how it will all work), sketch it out, think through some kind of architecture. Writing on it is really very fast - they threw together a prototype, experimented with it and said: “Wow! That’s so cool!” And they completely rewrote it. It would seem that they did the job twice, which made it take twice as long (well, one and a half). But no! It often turns out that this method is not bad, because if you write something right away, for example in Java, and then decide: “No, let's refactor, change the architecture completely and all that,” then you will spend 10 times more time . Such things also exist and live.

Conditions for the success of any programming language

Now let's talk about why some good-looking languages ​​did not survive, or live in a very limited space. When Wirth saw what bad companies Apple, Borland and all that did to his Pascal, he came up with an even better language - Oberon. It was just wildly minimalistic - that is, there were very few commands (Strings? Why do we need strings? We'll make an array of characters!). Well, something didn’t work out for him, to the extent that it could have worked out.

One more thing. The American military asked them to develop a cool language in which everything works and everything can be written. The result was a rather monstrous Ada language, in which, however, they still write something, but again, only for the military.

What is the problem? Why some languages ​​like Python, which no company supported in the beginning, took over the market. PHP, which is also poorly designed, also took over the market (most of it) on its own. And all sorts of billions of dollars were invested (the lecturer points to Ada) and did not go anywhere, nothing happened. What is this connected with? This is due to the fact that there is no infrastructure around these languages. That is, the language may be excellent, but as long as there is no documentation, as long as there is no community that can answer questions (on Stack Overflow) and, finally, most importantly, as long as there are not a large number of libraries, the language does not take off. That is, for example, you wanted to write a website on Oberon. What is it, why not? And the hassle begins... You can’t set up your own web server on Oberon to test it lightly, you can’t connect any libraries, because Oberon doesn’t have them. And all this is done through some crutches, the strength goes away, and in general you give up and write your website in pure C instead of Oberon. And those languages ​​that live well are those that know how to use libraries from other languages. The same Python in those places where it slows down. Well, in general, all sorts of standard things like sorting and something else are written in C, and it (Python) can interact with them.

Java also has a Java Native Interface. This is essentially C, that is, there (in my opinion, they always want to ban it, but it seems they haven’t banned it yet) these languages ​​can interact with already existing libraries (mainly C). And because of this, they take it and work. The idea I'm trying to convey to you is clear, right? Don't write in languages ​​that don't support the C library. Well, if you want to use something cool. Well, gradually they (the languages) acquire their own infrastructure. And they live somehow well.

Programming language and career guidance

Now let's talk about how to understand what you want in life. What are the coolest things? You can do some systems programming, right? It’s great for you to count these bits, you want to launch quadcopters, some kind of cameras, and do something else. Then, probably, C is your choice.

If you want to write, maybe not the most interesting applications in life, but it’s cool for you to design them, think about it all and earn a lot of money for sitting and being bored most of the time (you have to pay for this if you’re good at miss), here they are - Java, .Net. You go to work in some bank, write, go to work at nine in a white shirt, get a good salary and write according to the recommendations of the best Java developers, .Net sheep and all that...

If you want to write some applications, some kind of browser, some kind of toys, or something else, then C++ is great. If you want to write websites, then here they are, languages ​​of your choice (the lecturer shows Perl, Python, PHP, Ruby), there is not much difference. The only thing is that PHP will die before Python, so if you are lazy to learn new things, then learn Python. You won't notice much of a difference, but you'll last longer.

What's happening with Ruby is also unclear. Well, you can do PHP if you’ve already learned it, fortunately it’s so simple that it doesn’t take that long to relearn.

And finally, there is another area of ​​application of programming languages ​​- this is when a non-programmer uses them. Let's say you are a mathematician, physicist, chemist, analyst, anyone, and you need to quickly calculate something, analyze some data (for biologists, for example, how many arctic foxes live on the Commander Islands). You can put all this into a table in Excel or analyze it with something. Python is also good for this, it can work with text and there are a lot of libraries, statistical and all that. If you want to do some kind of Machine Learning, process some data, make predictions, then this is also done in Python the fastest way now. True, it should be noted that the tasks are very different. For example, if you want to trade on the stock exchange instantly in conditions where quotes change all the time, then no matter how cool Machine Learning you write in Python, people who have it written in something faster will have time to buy everything before Everything will be counted for you, even if their algorithms are worse. Therefore, even these machine learning tasks (some of them) require high performance (and extremely high performance), and, accordingly, other languages.

The only way to understand what you want is to try everything. Now I will say it as one of the visions of how you can try everything. How to become a programmer, and a happy one? So. Let's start with a clean slate. Here you are studying mathematics, Russian language and other compulsory and optional subjects at school, and your knowledge in the field of programming is reflected on the board (the lecturer points to an empty board) at the moment. And you want to become a happy person, do what you love, earn a lot of money and not deny yourself anything and be happy.

One way to achieve this. There are, of course, all sorts of inspiring stories about people who did not go to university at all, or dropped out and became billionaires, company owners, and so on. But it should be noted that most people who may not have become billionaires, but also live well, still graduated from university at some point.

What is the situation with admission to university (are you currently studying at school)? While you are in school, you need to understand that the next step is to enroll and take care of it. Pass the Unified State Exam or win the Olympiad. On the Unified State Exam you can use Pascal, C++ (including pure C), Python (I will not mention them further). At the Olympiad there is the same Pascal, the same C++, the same Python (we will now talk about its problems) and, most often, there is Java. There are other things that happen depending on the Olympics, but that’s not the point.

What does the graph of language distribution at the All-Russian Olympiad in Informatics look like? People who participate in the All-Russian, the coolest Olympics, what do they write in? It looks like this (here it means Pascal, and here it’s about 2000, and here it’s about zero, here it’s C++, and here it’s 2015).

In 2000, almost no one wrote C++. 15 years have passed, and almost no one writes in Pascal, despite the fact that Pascal is modern. This is a language that can do almost everything the same. It’s just that everyone has become too lazy to learn this, every new trend, and they continue to write everything in Borland Pascal, which of course can’t do anything. In C++, people write some algorithms (STL) to sort - great, they wrote sort() and that’s it. On Pascal, on regular, on the old one - this is a problem. We wrote some kind of set (it was needed) - great, we wrote it in C++, but in Pascal it was again a complete pain. Of course, you can do this with new Pascals, but they generally cost money. You may not have noticed this, but it is true.

There is also Java, but Java has a lot of letters. It is for large projects, but for small one-time programs it turns out very bad, because there are a lot of extra letters. But some people also write, you can learn to write on it. But it’s not on the Unified State Exam and the majority will still have to take the Unified State Exam.

What is best for the Unified State Exam? For the Unified State Exam, it is best (if you don’t know anything and they don’t teach you anything at school) to learn Python. Some exam problems can be solved perfectly on it. At the Olympiad, in general, it turns out that C++ is used, because Python is very slow, not everything is solved there.

Thus, you have studied some small subset of the language and some algorithms (possibly) and solved many problems in order to receive a diploma from your Olympiad and enter the university to receive a higher education.

I will now talk about how we structure the course at HSE, in what order the languages ​​are taught, how they are studied in applied mathematics and computer science at the Faculty of Applied Sciences, which we do together with Yandex. In the first semester - Python (not in full, approximately as you should learn in school) and C++ (already wider, much wider than it is usually taught in schools). Let me tell you right away so that you don’t be scared, if you suddenly want to enroll, you’ll say: “What, I already know all this, why should I go somewhere to study? I’d rather go somewhere else.” For those who already know how to program well, there is an opportunity to immediately move on to studying algorithms, and in a fairly theoretical preparation. We don’t look at them now, this (points to the board) is for those who are intermediate or not at all programmers.

In the first semester, the basics of Python are taught, just so that people learn how to program and so that no one is too offended. Python is rarely taught in schools; most people come with knowledge of Pascal or C++. Mostly even Pascal, if this is a mass school. Well, so that no one is offended, everyone learns a new language (as if they are in equal conditions). And C++ simply because from C++ you can then go anywhere.

Then comes the Algorithms course and a separate course project. Classic algorithms with implementation. It’s not that we took something in theory and calculated the complexity. At the lecture we took it, calculated the complexity, at the seminar we took it and implemented the algorithm. A project is where students make something complete. For example, one of the projects was: count... Let's say you have a lot of apartments in Moscow and you understand: “Oh, I have a lot of extra things, I’ll rent out some. And they set a certain price, and for some reason no one wants to rent an apartment from you - it’s probably too expensive. Or they set some price, they immediately took it from you and you think: “Oh, I probably sold it cheaply” - and you also get upset. That is, it was necessary to calculate how much it costs to rent an apartment? You enter the data - it creates an estimate for you. Such a site, which consisted of several things: take sentences, parse them, apply some kind of (probably) simple machine learning algorithm and make a beautiful web face in which you can select something, enter something, some meters, some number of rooms, number of saunas, number of jacuzzi in your apartment and roughly estimate the cost. That is, some kind of finished, not very complicated thing. Here it means (the lecturer points to the course on algorithms) such a core C++, with console input-output. Well, here (the lecturer points to the “project” sign) is something under the guidance of a mentor, perhaps with databases, perhaps with text parsing and something else.
Then there is the third semester - this is a course called “Computer Systems”. There is quite a bit of assembly language to understand (very little) and then something similar to pure C and interaction with operating systems, system programming in essence. And the project for the seminar is also something on the topic of all sorts of network interactions, quite low-level: develop some kind of utility, for example rsync (synchronization, perhaps you know. In pure C, more or less, write an analogue of rsync, which you will have over the network synchronize folders with all file accesses and so on).

And finally, the fourth. I don’t even know what to call it, it’s such a vinaigrette of technologies necessary for real development, for example, web development. That is, this is the practical application of databases, again something similar to what was done in the project (the lecturer points to the 2nd year project) but more in-depth. That is, these are more or less specific things, practical programming. In parallel with this comes every theory, and here they also do science.

And after two courses, people go off to do whatever interests them, because this thing covers the basics of programming quite widely and by this time people already understand that they don’t want to work with computer systems under any circumstances (they didn’t like system programming, for example ), but they want to work on some theoretical algorithms, calculate complexities, come up with some new things, distributed or something else. Or, on the contrary, they think that they don’t have much here ( the lecturer points to the line of the first course with Python and C++) went, then ( lecturer points to third course line, with systems programming) - I don’t like it, counting bytes and setting all sorts of restrictions on reading and writing, making streams, threads and something else. And in accordance with this, people choose a direction and study. That is, in principle, so that you do not develop “duckling syndrome” - you were the first to see your Pascal and now say “Pascal is power”; or more advanced - you saw C++ and started talking about everyone that C++ is strong, but everything else is not very good.

Now we need to look at this (the lecturer points to the list of courses on the board) more broadly - this is one of the methods that was chosen, in particular at HSE (it recently appeared, so it is quite modern). There are other ways to get acquainted. In other good universities, the order is a little different and other accents are placed. But they also try to introduce people to everything they have.

How to look for a job as a programmer

You are ( the lecturer points to the list of courses) did everything, studied at the university, did something else for two years more productively and you need to go to work. How to choose something for work? Firstly, you have become familiar with everything, gone deeper somewhere and already know what you love. You have to choose what you love, naturally. Because if you love, you put in the effort, you will have motivation and in general everything will be fine. Because it’s not just about money, it’s about making it interesting and enjoyable for you. Well, you want to get into a cool company and get a job. What kind of person would I personally like to see? Let's say a hundred students come to me - should I hire two or one. Why do they come, I don’t understand at all, who they are, what they are, how they are? At best, they will show me the diploma they received at the university, and I will say: “Wow! This is a cool diploma, but this is not so cool!” And I could be wrong, by the way. Maybe the person had a lot of free time and learned much better.

What would be great? Firstly, some open source project that you wrote from start to finish. Preferably, if I’m making some kind of infrastructure so that data can be quickly read, or something else, then, of course, I would be interested in having something open source written for me. They didn’t make a website, but something on the topic. Why am I interested in this? I can look at your code, I can see how often you committed, I can see how you reacted to bugs from users, bugs from developers who use it - everything is recorded, I look at everything and think: “Wow, this bug hasn’t been there for two years now.” closed, here you responded impolitely to the user, here’s something else - I won’t take it.” That is, this is your personal project.

Next, what else would be cool? I'd like to see how you did the teamwork. That is, you come to me for an interview and say: “The guys from the university and I have made some good application. I was making a database there, they were making some kind of mobile application there, and we also had a guy working there, a girl designer, a boy on technical support. There were five of us and we made a cool project.” Well, I see that it’s really your project, I say: “What’s yours?” I look at the code again and understand that you know how to work in a team with people.

A programmer is not someone who sits alone (indie) in a garage, somewhere with the lights off, doesn’t talk to anyone, grows a beard and writes. There is still some interaction with people. With a boss, for example, who may sometimes swear at you (bosses, they are like that, are not always kind). And I see that you know how to work with people and it makes me happy if you have some kind of good team. Even if it’s not good, it’s better than not having one.

What else would I personally like? If you proved yourself in big projects. For example, you committed something into the Linux kernel, if you are into systems programming, and fixed some bug. That is, they showed that you know how to read someone else’s code and know how to make some changes to it. I look: “Oh, really, you figured out something complicated and fixed some bugs!” And I begin to be very happy about this. Because I have... well, I don’t know... my programmer quit because his competitors offered him a higher salary, and I urgently need someone to fill his place - with you. I see that you only wrote from scratch, but you don’t know how to read and edit someone else’s code, and I get upset.

And finally, depending on the specific position, there are various other things. If you are getting a job as an analyst, I would like you to solve data analysis problems on Kaggle. If you are applying for some algorithmic things, I would like you to do some algorithms in sports programming. And finally, if you have thought about the profession, read how interviews are conducted, you have seen that some people there express great dissatisfaction: “I came, and they asked me what my hobby was. I sit like an owl and don’t answer because I don’t have a hobby,” and they think that HR’s do this. In fact, they are trying to understand how friendly and adequate you are. If you are unfriendly and inadequate, then no matter how genius and workaholic you are, a tough specialist with great knowledge, it will be difficult for the team to work with you, and you will not be able to complete the project alone. In addition, even if you pull it out, you can imagine what the burden is for the company. What if you come tomorrow and say: “Increase my salary 10 times, otherwise I’ll leave you.” It is clear that companies do not want to find themselves in such a situation. Therefore, cultivating adequacy and goodwill in oneself is as important (at a minimum) as developing some professional skills.

To summarize, what can we say? Which languages ​​are good and which are bad? Well, within a certain group of languages, for example between Ruby, Python and PHP, what should you choose? Of course, the correct answer is Python, but in fact the difference between them is in the number of bugs allowed, in the number of something else - 5%, well, maybe 10%. That is, if you already have a ready-made project written in PHP, then no one in their right mind would say: “Let's rewrite everything in Python.” They will say: “Let’s hire more PHP developers and continue writing in PHP.” Great, that's a good choice. It’s clear that if you suddenly decide to write some kind of project, then it might be wise to choose Python now. Although, that also depends. Maybe you have a lot of cheap PHP developers on the market, and Python ones are expensive, and you think: “Yes, the technology is cooler, but I’ll save money on ready-made developers.” And everything is great, you already come and work there.
How to choose between Java and C++? Yes, roughly the same thing happens. I think that by the time you decide in which language to start a new big project, you will have gained knowledge in your professional field and will be able to make the right choice. Now you don't have to make that choice yet, and so I advise you to do what you like.

The basics, as I already said, the very, very basics of programming (what is a function, what are if’ics, for’ics, arrays, something else) can be learned in more or less any language. For example, in C++, since there are a lot of similarities to it, and there are the least specifics in it (at this level), and there are the least amount of extra letters to write. Well, then, when you learn some complex architectural things, you will learn and you don’t need to worry too much about it. That is, the main thing is to try, look for what you like, and when you realize that it’s already 4 o’clock in the morning, and you’re sitting and writing for fun, because you like it - probably at that moment it’s clear that you’ve found yours .

This article is about extension and its importance for computer systems. So, it would seem, what could be so special about the extension of a program file? Nevertheless, we hope that readers will be able to obtain important and interesting information for themselves. The ability to understand extensions will serve a good purpose, as will be discussed below.

What extension does C plus plus have?

This programming language has its own file notation. The cpp notation is a special extension used for files containing C++ code. They contain code that is not yet ready for use (not compiled), which can be edited and changes made without significant costs and disruptions in the operation of the program. Using this extension, you can find out which file contains text in C (a programming language that is very popular now).

Extension and its importance in programming

Why do you even need a file name extension that is used by your computer? The fact is that a computer can process many different types of files, both within the installed operating system and with the help of additional software. An example of such software could be plugins installed in browsers, or interpreters of various programming languages ​​that can process running programs. It is to recognize which interpreter the computer should use, which machine code to use to play the file, and extensions are needed. recognizes the file type, this information will be provided to it by the available details. Thus, the cpp extension is a file containing a C++ document. After recognition, the interpreter will be able to open it, and the user will be able to work with the document.

What is a filename extension anyway?

But let's talk about file name extensions from a computer science perspective. Its purpose has already been determined - it is needed to identify the format or type of file. The extension is separated from the file name using a dot. Before 1995, Windows had a limit on the number of characters in an extension: there could not be more than three. In modern systems there is no such limitation. Even more, in modern file systems there can be files that have several types of extensions. They all follow through the point. This, however, does not apply to things like cpp.

Fraudsters often take advantage of this gift from developers. Criminals often disguise their malicious files that they push onto users’ computers as other programs and hide the main file extension (for viruses and various Trojans it differs from regular programs). It may even happen that all the real files are hidden or deleted, and completely different ones are put in their place. And it turns out that cpp is not cpp at all, but a computer virus. A good defense against this type of scammer is the command to display all types of extensions. You can enable this function in the “Control Panel”; just find the required item. And then you can be calm about your C plus plus files, and be confident that you won’t run a harmful program instead of them. Although here you must always look at the extension of the executable files.

Accuracy of information provided in the extension

Sometimes the extension does not accurately indicate the file type and does not solve all possible problems that may arise when using various programs. Thus, the .txt extension, familiar to many, does not provide information to the computer about what encoding the file is in. Therefore, often when opening text files you can see sheets of incomprehensible characters. It is especially sad to see such a state of a document if it was used to write program code. In such cases, file encodings should be changed until the computer can provide adequate text. You can try to calculate the required encoding based on incorrect characters, but you need to know which encoding leads to what in relation to which. For Word files, the same extension is also used, which does not make it clear which file a person is dealing with: a regular type or a formatted one. The extension also does not indicate which version is being used, which is useful when trying to open versions of earlier documents in later processing environments, as is the case with Microsoft Office.

Other ways and options to specify the format

There are other options to specify for the file system. But they are not common, and you most likely have never heard of them:

  • Saving information about the file format in the operating system itself. Inconveniences arise when you want to switch to another computer and work with the same file.
  • Application of the so-called “magic number” method. This is when a certain sequence of bytes is encrypted in the file itself, which indicates all the necessary information for the file to work. It has a certain potential, but it requires cooperation between software manufacturers.
  • For some Unix systems, a function has been developed that leaves special marks at the beginning of the file, intended for the interpreter.
mob_info