Programming: The Psychology of Computers

We are all closely related to programming, be it as a user, as an administrator, as a programmer itself, but ultimately it is something that will be more connected to our lives as the years go by.

In this article (the beginning of a small series that I plan to create), I want to share with you a few concepts about what I have been discovering about programming over the years. I don't claim to be overly technical, I'll explain why later. But what I do intend is to make them see the world with my eyes, and if they like the way it looks, then let them delve into it a bit 🙂

I will attack the simplest point of all first before going into details.

Why am I not going to do a technical post?

Well, for those who have read my post about best linux command, you will know a little about the cause of this focus. Technology is always changing, and if I write something today, if the post is well received, then I will always have to update the information. In today's most common languages, the only sure thing is change. By this I mean (and the programmers can prove me right) frameworks are always growing and modifying from their cores, this is because errors arise, some can be considered simple bugs, while others may become vulnerabilities. This is the reason why writing a post about a specific language, today, would guarantee me maybe a few months of usefulness, at best one or two years, but that's not the idea 🙂

Electricity is important

Those of you who have done a bit of research on the lowest software programming languages ​​will know that it all dates back to electricity. Formerly, programming was done at the hardware level, this means that those old clocks, calculators, and many other devices, could fulfill their destiny through programming hardware.

The problem

Changing hardware programming is expensive, and complicated 🙂 (at least that's what they told me 🙂 ). This is why processors emerged, which actually abstract that hardware layer to deliver a few commands to be able to do everything that was possible through hardware, only now in the hardware layer. software.

Processors

Today's processors have a limited number of functions, called instructions in many books. These allow you to perform the most basic functions that the hardware can perform, and to mobilize information through the computer's memory.

Registers

Registers are a space in which the processor stores information to be able to carry out work on the kernel, depending on the architecture they can have a different size and order, but in a simple way, their function is to store data that indicates to the processor one of the following types of work: move data, arithmetic and logic, and control of flow. Everything can be summarized in these types of functionalities.

Binary

The processors work at the binary level, this means that they only understand 0sy 1yes 🙂. A curious fact here 😀remember the GNU / Linux permissions? well, have you ever wondered how the processor actually recognizes those permissions? Simple 🙂 binary. At the lowest level, a processor will understand the permissions as a succession of 0s and 1s, and that is the reason why the octal that we form has the values for execution, 2 for reading and 4 for writing. For those who can read binary, they will understand that:

111100101111

They put the read, write and execute permissions for the group others while putting performance and reading for the group group and read only for the file owner. For the most curious, the last three 1s activate the setguid, setuid and sticky bit. If you do not know what this binary is, I can explain it in another post, if you do not know this about setuid, setgid and the sticky bit, I will leave it to you 😉 but I can also explain it elsewhere if necessary.

When curiosity calls ...

Well, if you have followed me here, then your curiosity should start to ask a lot of things, the first one I want to answer (and perhaps the only one that this post allows me because I am already writing a lot) is: If the calls are the same, why are the programs so different?

Psychology

Programming is the art of learning to read minds 🙂 I want to start this section with a quote I read a long time ago, Edsger Dijkstra said:

If debugging is the process of debugging, then programming must be the process of introducing them

And I can't find a better way to explain all this 🙂 why is programming the art of introducing errors? more than one will be wondering at this time. The answer is simple, because our minds are human, and humans make mistakes 🙂 it is in our nature, and it will be for as long as man exists on the planet.

Computers are not wrong

We are the ones who make mistakes, the teams will always limit themselves to reproducing what we tell them, they don't assume anything, they don't interpret anything, they don't object to anything, they just read and act. So in another C book I ever read something like this:

C is rude language, you can do a lot with it, but it will never stop you from shooting yourself in the foot if you want to do that, or so you tell it.

This is a rather curious truth 🙂 Since when working at such a low level, it is possible that many operations that are carried out can be destructive, something that does not happen with slightly higher level languages, since the error prevention layers they are older.

Everything is psychology

Every language, framework, programmer, respects and follows some kind of philosophy, and if it doesn't, it doesn't have a very promising future. Those of us who work on UNIX and derivatives will probably know the old phrase:

Do one thing, and do it very well.

This philosophy is the one followed by some projects like the kernel, quite small functions that only do one thing, but do it the best they can.

If we go to other languages, each one will have a function and objective, some more permissive and others more restrictive, but all following their own way of thinking.

Learn to read minds

There is a fairly common saying among programmers, that there are hundreds of ways to solve the same problem. This is true, but there is something much deeper about this aspect. Reading source code allows you to read minds - not just any mind, but the mind of the programmer (or programmers) who wrote it. It is a kind of virtual and deep diary 🙂 it allows you to know in depth the mind of the developer, and in the case of large projects, it allows you to see how their logical and critical thinking has grown over time. Something extraordinary and that greatly nourishes the minds of the youngest, because you can know the best paths of people who had to discover them 🙂

To be consistent

Many programmers and specialists say that we have to get out of our comfort zone, and although it is true, it is also more than necessary to maintain certain processes and formats. This is simple to explain, our minds are repetitive and respect structures, if you write code in the same way every day, in a short time you will stop thinking about the form and you will be able to concentrate on it. fondo. This allows you to see the logic of the program instead of the language syntax. And this is the reason why I consider that learning the concepts will always be more important than learning the forms. This is a personal opinion, but I hope that after reading all this you can understand why I consider it that way 🙂 also someone who has had to program in C, Java, Javascript, Python, Ruby, PHP, and others tells them 🙂 know the concepts makes it easy to write code.

Botton line

Well, this is the first step in a series that I hope will help you think differently about the art of programming, even invite you to delve into the concepts that allow you to execute the code that you have written maybe hundreds of times, but they haven't stopped to think about what it really does. And for those who have not started programming, but would like, to be able to prioritize a little about what is really important to know 🙂 Greetings


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Javier G. Delgado said

    A very conscientious article in which programming is discussed (in this case) perhaps in a new language that programs in greater depth, I support the following.

    1.    ChrisADR said

      Hi Javier, thank you very much 🙂 I think this is very important because they have always wanted to teach me only to reproduce code, the famous Ctrl + C… Ctrl + V 🙂 but I have never let myself be dragged by this, even if it is the simplest problem in the world I'd rather write it than copy it from someone else, it makes me feel like it's my creation.
      regards

  2.   raft said

    Already waiting for the next chapter, I stopped programming a long time ago, and I think I can find in some later chapter some cause for my decision, really, since this chapter I take off my hat.

  3.   ChrisADR said

    Hello Balua 🙂
    Well, I'll come up with something for the next one. It's a bit complicated to order everything in such a way that the thread can be followed from any post, but I will try to have this one (and several others that have asked me) very soon. Thanks for your comment. Cheers

  4.   Other said

    A gem of an article! I hope the next ...