English is a strongly typed language
Knowledge in different areas allows you to transfer the observed dependencies in one area of knowledge to another area and understand it. Knowledge is like mosaic elements, like design patterns. Knowing some patterns in chemistry, some in mechanics, some in electronics, you can apply them to each other for a better understanding. A classic of the genre is an explanation of how electric current flows using water pipes as an example.
I will share my mix of patterns in the field of learning English, programming, philosophy. That is, I consider the study of English as the study of a strongly typed programming language.
In a strongly typed programming language, a string variable is declared as:
string s = "abc"
тип имя = значение
In English, a variable is declared as:
имя тип значение
John is a driver
Variable name – John, variable type – IS (type BE), value – Driver. That is, in English, when it is necessary to assign some coordinate-material property to some object, the BE type is used.
When it is necessary to assign a motion property to an object, the DO type is used.
имя тип значение
John does exercises
Name – John, type – DO (English DO), meaning – charging. That is, it is reported that the object John is in motion, which has the meaning of charging.
When it is necessary to assign an ownership property to an object, the HAVE type is used.
имя тип значение
John has a car
Name – John, type HAVE, value – machine. John is reported to have a car.
In general, any object is described by three types of values. And this is clearly expressed in English. The words BE, DO, HAVE, the use of which is not particularly clear to Russian people, are the types of meanings TO BE, DO, HAVE. Here, for understanding, a pattern from philosophy is included:
An object can BE: somewhere (according to coordinates in space or time); somehow (material properties: color, shape, temperature, hardness; role)
An object can DO something (action, movement).
An object can HAVE something.
For example, there is the following text: “John is a driver. He has a car. He drives to work every morning. John lives in the country. John has been on vacation for a long time”
“John driver” is a statement describing the role of an object, that is, it is a statement of type BE(BE). We translate into English. We work according to the scheme NAME TYPE VALUE. JOHN IS a DRIVER.
“He has a car” is a statement describing the ownership of an object, that is, of type HAVE. We translate into English. We work according to the scheme NAME TYPE VALUE. JOHN HAS a CAR.
We figured out the declaration of variables. Now consider the declaration of a function that returns a result. In human language, a function that returns a result is a question. By asking a question, we want to get an answer, that is, some value. And as it is written in the title of the article, English is a strongly typed language, and when declaring a function, you must specify the type of the return value.
string function(){};
тип тело_функции
Is John a driver?
Here, an English-speaking person, asking a question with the word IS, immediately typifies the expected answer according to the type BE. That is, he asks about the material-coordinate properties of the John object.
Does John go to the gym?
Here the questioner typifies the interlocutor’s brain to produce a response of the type DO (DO). That is, what Action is engaged in.
I think I proved the typing of the English language. We go further. JavaScript does not require you to specify a type when declaring a variable.
let s="abc";
In Russian, too, variables are not typed.
Иван водитель
имя значение
Иван идет
имя значение
I’m a hobby programmer and I don’t write much code. But he worked out the following rule for naming variables: a variable of type String must begin with “s”; variable of type integer on “i”; boolean to “b”, etc. for instance
string sTemp = "abc";
int iTemp = 1;
bool bTemp = true;
This immediately in the code allows you to see what type of data the variable works with. And for the array I use the prefix “arr”, for the two-dimensional “arr2”
string[] arr_sTemp = {“a”, “b”, “c”};
string[,] arr2_sTemp = {{“a”, “b”},{“c”, “d”}}
That is, with the help of a prefix to the variable name, I type it for myself for my perception of the type of the variable. Such typification of variables by prefixes and endings is in the Russian language. The ending “th” is the type BE (red). The ending “t” is a type of DO (run). Various prepositions typify coordinates in space. “Table tennis” in Russian is much more informative than just “table tennis”. That is, the Russian language is typified by prefixes and variable endings. English is typified by separate words and there are only 3 of them (be, do, have). Therefore, English is easier and it is the language of international communication.
Finally, a boolean function returns a TRUE/FALSE or YES/NO response. A function of type boolean can be marked with the prefix “boo”
boolean booTemp = true;
In Russian, a logical function or a question that implies the answer “YES / NO” is also marked with the prefix “boo”.
bool booDeshPyt(sdrink temp)
{
if (temp == "whiskey")
{
return boodu;
}
return neboodu;
}
🙂