Every lesson includes additional materials: illustrations, recommended articles and videos, some optional resources and the full lesson transcript.
These first lessons don't have many links yet, but we're gradually going deeper and deeper, so expect more stuff as you follow along.
This is Tota.
He is a caveman.
One day he was walking in the forest, and all of a sudden a large noisy sphere appeared out of nowhere, sparkling and blinking.
"Just like Terminator movie", - would've said Tota if he had seen Terminator.
The sphere disappeared quickly, and left a smoking black box on the grass.
Tota was curious, he waited for the smoke to calm down and went ahead to explore the box.
It was a heavy thing with two buttons on the side, one with an X and one with an O on its face, a long hole and a lever.
Being a caveman, Tota tried to touch it, kick it, smell it and roll it around. The box was obviously not alive, but the buttons intrigued him.
Tota discovered an interesting thing: if he pushed X once and O once, then pulled the lever, then O would glow for a momemnt, then X would glow for a moment.
Did I tell you that Tota was remarkably smart? Top of his cave.
He then decided to push the buttons in the same way as they glow: O, then X, then pulled the lever. The box answered again.
Tota repeated the new pattern. There was another answer. When Tota pushed the last pattern, the box beeped and a produced a ball of lightning, scaring Tota immensely and putting the tree in front of him on fire.
So, now Tota had this weapon of sorts. He killed many animals with it, and enjoyed many meals near a fire.
Soon he discovered more patterns: one would create some noise he really hated, another would spit a long leaf with markings, and others would do nothing at all.
Once Tota found an even more advanced feature of this device. He wanted to make fire again, but instead of just pushing the lever once, he pushed and held it. When he released it moments later, no fire came out, but both X and O started blinking. He desperately pressed O and they stopped blinking. From then on, simple O and a lever push produced the fire, so much easier and faster than before!
He realized that he had trained this beast just like he trained a baby wolf one day.
So... what is this thing?
Of course, Tota calls it Boomwoom, but we can clearly come up with something better. At first, one might think this is some sort of overly complicated weapon. But it does some other weird stuff, like music... and even printing. It's not like a home appliance, although, some washing machines are more complicated to operate.
Let's start with the buttons. Seems like the machine "understands" certain combinations and doesn't understand others. We don't know the meaning of the buttons and combinations, so I want to call it "code", as in "I have no idea what that is, but it probably means something". Some codes work, some don't, just like in our speech some sounds mean something, and others don't. 'Language' seems like a good word for it. This machine understands certain language of codes.
Okay, how do we call this machine then? Code-language-understander? "Understand" sounds important to us, but the key thing about the machine is not that it just understands, but does something as a result. It understands the code for "fire flash", and immediately produces the fire flash. So, it's more like... code-language-performer? It performs some actions.
The guy from the future who sent this thing to the stone age might call it differently, but we today would definitely call this machine a "computer". That's how we call machines that accept code and perform some actions.
You might think this is a terrible computer with some terrible code. Today we have these magical devices with awesome features and programming languages with easy to read codes like this:
By the way, you will be able to write and understand this easily by the end of the course.
And yes, nowadays computers are different. But... not too different. We haven't yet explored this machine thoroughly enough, but trust me: fundamentally, they are the same. Just like this... is very different to this... both use the same principles and capable of the same thing, to different extent.
So, we can keep looking at that weird machine and understand something important about computer programming in general:
First: Computer understands a particular, strict language. Random pushes don't do much, only certain combinations work. And one tiny mistake in a pattern breaks everything. And second: Computers are really stupid
You might think this last part is due to this particular computer being weird and underpowered, but I am really talking about computers in general. They are very powerful but very stupid. Make no mistake, all they do is perform whatever we tell them. No magic. But, of course, for Tota it's magic indeed, just like some modern devices are magic to us, unless we learn computer programming. Fortunately, this is exactly what we are going to do in this course.
The Hexlet support team or other students will answer you.
Выделите текст, нажмите ctrl + enter и отправьте его нам. В течение нескольких дней мы исправим ошибку или улучшим формулировку.
Загляните в раздел «Обсуждение»:
Programming courses for beginners and experienced developers. Start training for free.
Our graduates work in companies: