DATA PROCES­SING



Didn't I say that the only thing your computer is busy with is data processing? Indeed, everything that happens after launching a program and before output is called data processing. When it finishes, you will see the result. The letters you read in this app right now is the result of data processing too.

So what is data processing? Why is it important to understand the process?

Data processing includes:

  1. Getting new data based on source data.
  2. Changing the shape of data for further processing or to make code more comfortable and readable.
  3. Revising and clarifying the source data.

The example of getting new data based on source data is simple math. How old will you be in 2 years? Easy. So, the source data is your current age, the new data is a number that is calculated by using the formula "CurrentAge + 2".

Imagine the line: "August 1, 25, 29, 23, 18, August 2 26, 31, 26, 21, August 3 24, 29, 23, 19". Fine, and what did you understand from this?

Let's go further. Compare the previous with this one:
August 1 August 2 August 3
Morning +25 +26 +24
Afternoon +29 +31 +29
Evening +23 +26 +23
Night +18 +21 +19

You guessed it, there was the example of changing the shape of the data. Cuter, right? That's the reason.

The design of Google's search results, made in the shape of a list, is also related to. But it could definitely look quite uglier, separated only by commas, as shown in the example above (horrifying).

For example, the search request "programming languages" could look like that:

A list of programming languages - Wikipedia,https://en.wikipedia.org/ › wiki › List_of_programming_languages The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, ... ‎‎List of programming ...· ‎Timeline of programming ... · ‎A+ · ‎A Sharp (.NET) Programming language - Wikipedia, https://en.wikipedia.org › wiki › Programming language A programming language is a formal language, which comprises a set of instructions that produce various kinds of output. Programming languages are used in ... ‎List of programming ... · ‎Lists of programming languages · ‎History of programming Guide to Programming Languages | ComputerScience.orgwww.computerscience.org › resources › computer-programming-lang... Oct 22, 2019 - The portion of the language that a computer can understand is called a “binary.” Translating programming language into binary is known as ... Programming Languages You Should Learn in 2020 | IEEE ...www.computer.org › publications › tech-news › trends › programming-... Programming languages and computer coding have made life simpler for us. Whether it's automobiles, banks, home appliances, or hospitals, every aspect of our ... index | TIOBE - The Software Quality Companywww.tiobe.com › tiobe-index In 2014 Apple announced the new programming language Swift to be the successor of Objective-C. At that moment Objective-C was at position #3 in the TIOBE ...

But the search engine is cool. It processes data and make it comfortable for the eye. Be like a search engine.

A search engine also reviews and refines data it has. How? There are many sites in databases. On request, the computers of a search engine do colossal work. They "throw away" all irrelevant results, structure the rest and... as it was said previously, show a pleasant version. This is about data reviewing.

Data is refined without our knowledge. Search engine spiders or "crawlers" update information about sites, regularly searching for something new. In other words, they refine data.

Data processing is the process of receiving or/and modifying data in a certain order according to certain rules.

The order must be followed, otherwise data processing won't work the way you need.

That's how it goes.



PROGRAM


Each computer program conditionally consists of three blocks:

  1. The block of data input.
  2. The block of data processing.
  3. The block of data output.

As it was said, the blocks are conditional. They serve as a scheme of a program. There is no problem in defining titles of the chapters, tables, pictures and other elements in a book. But if we speak about blocks in a program, we can't split them clearly. The blocks are defined intuitively. They could be mixed randomly in program code, repeated, modified, but they still will implement particular functions (input/process/output).

Making an algorithm of a program, be sure you have included all of three blocks.


CS:GO EXAMPLE


Let's take a closer look at the sweet creation of Valve - Counter-Strike: Global Offensive (until they spoil it again). Three standard block described above are also presented here:

  1. Data input. It is implemented with a keyboard and a mouse.
  2. Data processing. It includes calculation of shooting, calculation of players' location in response to signals from a keyboard and a mouse.
  3. Data output. It is generation of the image on the screen according to the game situation.

All the blocks work in parallel. It means that computer checks in milliseconds which keys are pressed, whether the mouse is moved, receives data from the Internet, calculates the location of other players, their shots, jumps, wounds, and redraws picture on the screen in relation to changing situation.

One more scheme of the blocks:

So, every program has the code that is responsible for data input with a keyboard, a mouse or even a phone connected to PC. There is also the code responsible for data processing that could, for example, distinguish photos from audio files on the smartphone. And finally, there is the code which outputs data. For example, saves selected photos in the memory of PC.

We, as game developers, should know (again!) that there is always the code responsible for input. There is always the code responsible for processing. There is always the code responsible for output.

Now, we come to some terms. They will help to understand the theory of programming better. Be ready, it's going to be interesting (I hope so).


TERMI­NOLOGY


If you pour milk in water, you will get a mix of milk and water. Maybe (actually, I'm not a chemist to say exactly) you could separate them back to their original condition after certain procedures. But at the moment our mix is composed of milk and water molecules that randomly move and form a liquid. Fine, now try to explain it to a 3-year-old child, explain how molecules interact to each other, mix, create a unified thing that looks routinely to our eyes.

With this strange comparison, I want to show the absurdity of the idea to clearly distinguish certain blocks of a program. You can learn how to create and to recognize only by practice. Learn, learn, learn (as Lenin said). Every block might contain different operators: input, processing or output ones, - but the main purpose of every block is defined only by a programmer. He does it as he sees fit. He does it for his own comfort (from this point of view, the work of a programmer looks much more attractive, you know).

So, let's not separate milk from water very precisely. Leave until it works. We need more experience and time to feel the architecture and the logic of a program. At the current stage, let's agree to say white for milk and transparent for water.

Some programming language syntax element we will call input operators (functions, commands etc.), some we'll call processing operators, and some - output operators.

I will conclude an agreement between you and me in this place of the coursebook to design each program so that it will contain at least one input operator, one processing operator and one output operator. And we will try to use them right in this order.

How much "blocks" do you think there are in the program below?

Answer

One. It's output block that shows data on the screen. And print() is the output function. No data is received in the program, no data is processed by the computer. It just prints on the screen. That's all folks. Only one!


Now, keep attention to main purpose of operators/functions, while reading the following material. Ask yourself, "What are they for?". Then answer, "For data input". Or "For data processing". Or "For data output".


THE MOST IMPOR­TANT BLOCK


The most important block is... (a place for a drum roll). Any block. All three block are interrelated and necessary. I'll prove.

If there was no input data block in СS:GO, the game wouldn't react to:

  1. A keyboard. You press - nothing changes.
  2. A mouse. You move and spin it. And see nothing. Even if you have an extra-awesome mouse with 12000 dpi.
  3. A network game... No more matchmaking, no more yelling school kids.

If there was no processing data block, the game would:

  1. Do nothing. The void. Like infinite space. Even if it got data from a keyboard, a mouse, network, nothing would happen. Just think what CS:GO could output without any processing. Static pictures only.

If there was no output data block, you would face such problems:

There is no the most important block. Input, processing and output are interrelated like earth, water and air. One without the other is meaningless.

We'll use all three block. Just make sure that the program receives data, processes and displays it on the screen. Don't forget about the user. His monitor is turned on, he would like to see something.

Yes, dear readers, it's quite important. Otherwise, I would not single out this idea in a whole chapter!

Follow me, my friends! It's time to move further!


© 2019-2021 Viktor Trofimov
© 2019-2021 Translation and adaptation by Danil Shentsov
[ Top page ]