📜 ⬆️ ⬇️

Magic layer

Any rather complex technology is indistinguishable from magic.
Arthur Clark


As a programmer and just a computer enthusiast, I know how they work, more than the first person I meet. It is always interesting for me to watch how people use computers who know less about me than them. For many of them, the process is as follows: they click on something, the computer does something mysteriously magical, and the results appear on the screen.

However, even people familiar with the technology as a whole may at some stage find that what is happening could be magic with equal success - very few people understand all the processes taking place entirely. The next step after not understanding users and the buttons that they click can be considered bad developers who type (or copy) code that they do not really understand, and somehow it works. Their magic layer is thinner than that of users: at least they realize that they need to write code, but they don’t understand its essence. Their magic layer contains function calls, language syntax and code meaning; they can understand separate fragments, but the whole program remains a mystery to them.
')
The next stage - novice developers, potentially competent, but not yet possessing the necessary knowledge. They understand how most of their code works, they know how to structure functions and when to use (or not use) objects, and can write a program from scratch, but they may not yet understand what happens in library functions or as a compiler creates a program from their code.

As the programmer's skill increases, the magic layer becomes thinner. Library functions become just functions that you yourself write, except with system calls. It turns out that the compiler reads the code and converts it into machine code, which is executed by the processor. Magic is expelled from their code and finds shelter in the nuances of the compiler and operating system.

Finally, when the developer destroys these last strongholds of magic, he sees the whole picture - how much software is enough. But this is not the end of the story! Magic is expelled from software, but iron remains: how are these system calls translated into data that are written to disk? How does the processor know what to do with assembler commands? Congratulations, your magic has receded to the hardware level.

From translator


This translation is like an excuse for my previous article , in which I proudly call magic simple tricks with a low-level representation of strings and numbers in C ++. The note seems somewhat incomplete to me - I got at least two conclusions from it.

Romantic conclusion: My own layer of magic is thick enough, and it seems to me that this is not so bad - the more magical discoveries in front :-)

Skeptical conclusion: The fight against magic can go on and on: the physical principles of technology, the nature of electromagnetic phenomena, the structure of matter ... In science fiction novels there is a plot: when a developed civilization watches the developing, the scientist-inventor-philosopher appears in the latter, who begins to interfere, he is simply given access to information about all the achievements of civilization. This is more than he can learn in his entire life, so he is no longer dangerous - he will no longer do anything of his own. So in this case, it is important for the programmer to keep the line between incompetence and excessive enthusiasm for exposing magic.

Source: https://habr.com/ru/post/113114/


All Articles