The Science of Logic in Programming

The Science of Logic in Programming

This article is devoted to a comparative analysis of logical entities from the work of the German philosopher Georg Wilhelm Friedrich Hegel "Science of Logic" with their analogues or their absence in programming.

Essences from the Science of Logic are in italics so that there is no confusion with the generally accepted definitions of these words.

Pure being

If you open the definition pure being in the book, you will see the interesting line "without further definition". But for those who have not read or understood, do not rush to accuse the author of dementia. Pure being - this is a basic concept in Hegel's logic, meaning that there is some kind of object, please do not confuse it with the existence of an object, the object may not exist in reality, but if we somehow defined it in our logic, it is. If you think about it, then there really is such a thing as pure being it is impossible to give a definition, and any such attempt will come down to the fact that you will simply refer to its synonyms or antonyms. Pure being such an abstract concept that it can be applied to absolutely anything, including itself. In some object-oriented languages, it is possible to represent anything as an object, including operations on objects, which in principle gives us such a level of abstraction. However, in programming the direct counterpart pure being No. To test for the existence of an object, we need to test for its absence.

if(obj != null);

It is strange that such syntactic sugar does not yet exist, given that this check is very popular.

Nothing

How could you guess nothing is the absence of anything. And its analogue can be called NULL. It should be noted that in the science of logic nothing is pure beingbecause it also exists. This is a bit of a snag, we cannot refer to NULL as an object in any language, although in fact it is one too.

Formation and moments

Becoming is the transition from nothing Π² being and from Being Π² nothing. This gives us two time, the first one is called emergence, and second passing. Transition so named instead of disappearing, because a logical entity cannot, in fact, disappear unless we have forgotten it. Withdrawal as such, an assignment procedure can be called. In case we have an initialized object, moment of occurrence, and in case of assigning another value or NULL moment of transition.

obj = new object(); //Π²ΠΎΠ·Π½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΠ΅
obj = null; //ΠΏΡ€Π΅Ρ…ΠΎΠΆΠ΄Π΅Π½ΠΈΠ΅

Present being

In short existence - this is an object that does not have a clear definition, but has certainty. What does it mean. The canonical example is an ordinary chair. If you try to give it a clear definition, you will run into a lot of difficulties. For example, you say: β€œthis is a piece of furniture designed for sitting”, but the chair is also made for this, etc. But the lack of a clear definition does not prevent us from isolating it in space and using it when transmitting information about it, this is because in our head there is certainty chair. Perhaps some have already guessed that neural networks were created to isolate such objects from the data stream. A neural network can be defined as a function that determines this certainty, but there are no types of objects that would include clear and fuzzy definitions, so such objects cannot be used at the same level of abstraction.

The Law of the Transition of Quantitative Changes into Qualitative

This law was formulated by Friedrich Engels as a result of the interpretation of Hegel's logic. However, it can be quite seen in the first volume in the chapter on least. Its essence lies in the fact that quantitative changes to an object can affect it quality. For example, we have an ice object, when the temperature accumulates, it will turn into liquid water and change its quality. To implement this behavior in an object, there is a "State" design pattern. The emergence of such a solution is caused by the absence in programming of such a thing as base for occurrence object. Base determines the conditions under which the object can arise, and in the algorithm we ourselves decide at what point we need to initialize the object.

PS: If this information is interesting, I will review other entities from the Science of Logic.

Source: habr.com

Add a comment