Which method does not belong to the types of abstraction. Abstraction - what is it and how abstract thinking (abstraction) helps to see the essence

Parameter name Meaning
Article subject: abstraction
Rubric (thematic category) Programming

OBJECT MODEL

The object-oriented approach is based on a combination of a number of principles called object model .

The main principles are: abstraction, encapsulation, modularity, hierarchy. They are the main ones in the sense that without them the model will not be object-oriented.

In addition to the main ones, we will name three more additional principles: typing, parallelism, persistence. By calling them optional, we mean that they are useful in the object model, but not required.

Humans have developed an extremely efficient technology for coping with complexity. We abstract from it. If we are not able to completely recreate a complex object, then we have to ignore not too important details. As a result, we are dealing with a generalized, idealized object model.

For example, when studying the process of photosynthesis in plants, we focus on chemical reactions in certain cells of the leaf and do not pay attention to the rest of the parts - cuttings, veins, etc.

Abstraction- a set of essential characteristics of a certain object ͵ that distinguish it from all other types of objects and, thus, clearly define the features of this object from the point of view of further consideration and analysis.

abstraction- the process of highlighting abstractions in the subject area of ​​the problem.

Abstraction focuses attention on the external features of the object and allows you to separate the most significant features of behavior from the non-essential ones. This separation of meaning and implementation is called abstraction barrier . The establishment of one or another barrier of abstraction generates many different abstractions for the same object or phenomenon of the real world. Abstracting to a greater or lesser extent from various aspects of the manifestation of reality, we are on different abstraction levels .

For example, consider the system unit of a computer. A user who uses a computer to type text͵ does not care what parts this block consists of. It is worth saying that for him this is a box with buttons and the ability to connect external storage devices. It abstracts from concepts such as ʼʼprocessorʼʼ or ʼʼRAMʼʼ. On the other hand, for a programmer, who writes programs in languages low level, the abstraction barrier lies much lower. It is extremely important for him to know the processor device and the commands understood by it.

Another additional principle is useful, called principle of least surprise . According to him, an abstraction should cover all the behavior of an object, but no more and no less, and not introduce surprises or side effects that lie outside its scope.

All abstractions have both static and dynamic properties. For example, a file as an object requires a certain amount of memory on a particular device, has a name and content. These attributes are static properties. The specific meanings of each listed properties are dynamic and change in the process of using the object: the file can be enlarged or reduced, its name and contents can be changed.

We will call client any object that uses the resources of another object, called server . We will characterize the behavior of an object by the services it provides to other objects and the operations it performs on other objects. This approach focuses on the external manifestations of the object and implements the so-called contract programming model . This model is as follows: the external manifestation of an object is considered from the point of view of its contract with other objects, in accordance with this, its internal structure must be carried out (often in interaction with other objects). The contract fixes all the obligations that the server object has to the client object. In other words, this contract defines a responsibility object - that behavior, he is responsible for ĸᴏᴛᴏᴩᴏᴇ.

Each operation stipulated by the contract is uniquely defined by its signature – a list of formal parameter types and a return value type (in C++, the return value type is not part of the signature). Full set operations that a client can perform on another object, together with the correct order in which those operations are called, is commonly referred to as protocol . The protocol reflects everything possible ways, by which the object can act or be affected. Thus, the protocol completely defines outward behavior abstraction.

Example.
Hosted on ref.rf
In a hydroponic greenhouse, plants are grown in a nutrient solution without sand, gravel or other soil. Managing the operating mode of a greenhouse installation is a very responsible task. It depends both on the type of crops grown and on the stage of cultivation. A number of factors need to be controlled: temperature, humidity, lighting, acidity and nutrient concentration. In large farms, to solve this problem, automatic systems are often used that control and regulate these factors. The goal of automation here is to achieve compliance with the cultivation regime with minimal human intervention.

One of the key abstractions in this problem is sensor . Several types of sensors are known. Everything that affects the yield must be measured. Τᴀᴋᴎᴍ ᴏϬᴩᴀᴈᴏᴍ, we need sensors for water temperature, air temperature, humidity, acidity, lighting and nutrient concentration.

From an outside point of view temperature sensor - ϶ᴛᴏ an object that is able to measure the temperature where it is located. Temperature - ϶ᴛᴏ a numerical parameter that has a limited range of values ​​\u200b\u200band a certain accuracy and means the number of degrees Celsius.

Sensor location - ϶ᴛᴏ not ĸᴏᴛᴏᴩᴏᴇ a uniquely defined place in the greenhouse, the temperature in which is extremely important to know. There are probably few places like this. For the temperature sensor, it is not the location itself that matters, but only the fact that this sensor is located in this particular place.

Let's consider the implementation elements of our abstraction in the C++ language.

typedef float Temperature; // Temperature in Celsius

typedef unsigned int Location; // A number that uniquely defines

// sensor position

Here, the two type declaration operators Temperature and Location introduce convenient aliases for the simplest types, and this allows us to express our abstractions in domain language. Temperature - ϶ᴛᴏ numeric data type in floating point format for recording temperatures.
Hosted on ref.rf
Values ​​of the Location type enumerate places where temperature sensors can be located.

Consider the duties of a temperature sensor. The sensor must know the temperature value at its location and report it on request. The client in relation to the sensor can perform the following actions: calibrate the sensor and receive the current temperature value from it. Τᴀᴋᴎᴍ ᴏϬᴩᴀᴈᴏᴍ, the ʼʼTemperature sensorʼʼ object has two operations: ʼʼCalibrateʼʼ and ʼʼCurrent temperatureʼʼ.

struct TemperatureSensor ( // Temperature sensor

temperature curTemperature; // current temperature in

// sensor location

location loc; // sensor location

void calibrate(Temperature actualTemperature); // calibrate

Temperature currentTemperature(); // current temperature

This description introduces a new TemperatureSensor type. The important thing here is that, firstly, the data and the functions that change them are combined together in one description, and, secondly, we do not work directly with the data, but only through the corresponding functions. In particular, here we have used the so-called set- and get functions , which respectively set and return the values ​​of variables (calibrate is a set function, currentTemperature is a get function).

Objects of this type are introduced in the same way as variables of standard types:

TemperatureSensor TSensors; // array of one hundred type objects

// TemperatureSensor

The functions declared inside the declaration are called member functions . They can only be called on a variable of the corresponding type. For example, you can calibrate the sensor like this:

TSensors.calibrate(20.); // sensor number 3 is being calibrated

Since the name of the object on which the member function is called is implicitly passed to it, there is no TemperatureSensor type argument in the function argument lists that specifies the specific sensor to operate on. This object inside the function can be explicitly accessed by the this pointer. For example, in the body of the calibrate function, you can write one of two equivalent statements

this -> curTemperature = actualTemperature;

The central idea of ​​abstraction is the concept of an invariant. Invariant - ϶ᴛᴏ notĸᴏᴛᴏᴩᴏᴇ boolean condition whose value (true or false) must be preserved. For each operation of an object, you can specify preconditions (ᴛ.ᴇ. invariants assumed by the operation) and postconditions (ᴛ.ᴇ. invariants that the operation satisfies).

Consider the invariants associated with the currentTemperature operation. The precondition includes the assumption that the sensor is installed in the correct place in the greenhouse, and the postcondition that the sensor returns a temperature value in degrees Celsius.

Changing an invariant breaks the contract associated with the abstraction. If the precondition is violated, then the client does not comply with its obligations and the server cannot perform the task correctly. If the postcondition is violated, then the server has violated its obligations, and the client can no longer trust it.

The C++ language provides a number of special facilities for checking conditions.

If any condition is violated, generate exception (exception) . Objects can throw exceptions to prevent further execution of an operation and alert other objects to the problem, which in turn can take over catching the exception and deal with the problem. The reason for this separation is that the server object that detects an error may not know what to do to fix it, and the client object may know what to do but not be able to determine where it occurred.

C++ has a special exception handling mechanism that is context sensitive. The context for throwing an exception is a try block (trial block). If an exception occurs when executing statements inside the try block, then control is transferred to the exception handlers that are specified by the catch keyword and are located below the try block. Syntactically, a catch handler looks like a function with one argument, without specifying a return type. A single try block must have multiple handlers that differ in the type of the argument.

try( // trial block

catch(char * error)(. . .) // argument name used in handler

catch(int)(. . .) // argument name not used in handler

catch(…)(. . .) // handle all exceptions

An exception is thrown by specifying the throw keyword with an optional expression argument.

The exception will be handled by calling the catch handler whose parameter type matches the type of the throw argument. When searching for a suitable handler, all handlers are looked up in the order in which they were written.

If there are nested try blocks (due to nested function calls, for example), the handler of the deepest block will be used. If a handler corresponding to the type of the throw argument is not found at this level, the current function will exit (with the destruction of all local objects) and search in the try block with a smaller nesting depth, etc. After the exception is handled, control is transferred to the statement following the descriptions of the catch handlers.

Example.
Hosted on ref.rf
Consider a stack implemented using a fixed length array.

int stack ; // no more than a hundred elements on the stack

inttop=0; // room available space to place an element

void push(int el) (

if(top == 100) throw 1; // check for overflow

// (precondition top< 100)

else stack = el; // push the element onto the stack

if(top == 0) throw 0; // check for emptiness

// (precondition top > 0)

else return stack[--top]; // pop an element from the stack

try( // trial block

if(i!=k) throw 2; // postcondition violated

catch(int error)(. . .) // if error = 0, then the stack is empty;

// if error = 1, then the stack is full; if error = 2, then the stack is invalid

In the example, the throw argument is an integer - ʼʼthe number of the exceptionʼʼ. In complex programs, special exception types are developed to allow more information to be passed to the exception handler.

Abstraction - concept and types. Classification and features of the category "Abstraction" 2017, 2018.

Knowledge is an important part of human life. A person learns the world around, feelings, life itself. Since ancient times, people have sought to know nature, space, any phenomena of life on Earth.

A person is interested in everything - flower petals, a bird fluttering in the sky, ocean waves, other planets. The desire for knowledge is a natural human quality.

The desire to know the world has prompted mankind to create more and more new tools and household items. The desire for knowledge led to the creation and development of civilization.

The process of cognition would not be so interesting without abstraction. With the help of abstraction, ancient people sought to see the Earth and the cosmos from the outside, as well as the role of mankind in this world.

Abstraction in everyday life

Abstraction allows a person to see from the side not only current events and the surrounding reality, but also himself. It allows you to see your actions and your behavior from a different angle, helps you understand your aspirations and the reasons for certain actions.

To abstract means to see reality as a spectator, to feel oneself outside of all events. This approach removes emotional dependence from what is happening. A person opens up new facets that he had not noticed before.

When abstracted, the problem appears in a different light. It becomes possible to see the situation from all sides. And so comes the understanding of why this happened, and how to fix this situation.

For example, a difficult situation has arisen that urgently needs to be resolved. The person involved in the problem does not see possible ways solutions. He thinks he is at a dead end. By abstracting from the problem, a person will understand how to act in this situation.

The role of abstraction

Abstraction helps a person in in full to know oneself, the world, and everything that interests him. And most importantly - abstraction allows you to know the essence of life on Earth, the secret of the universe, to know your own role in this life.

Abstraction as a conscious process of cognition and self-knowledge is inherent in a person who has realized himself as a person. On the other hand, young children also sometimes talk about themselves in the third person, as if they are watching themselves from the side. Perhaps for children, the process of abstraction is unconscious. And to some extent, for them, this is a mechanism of self-defense.

Thus, abstraction for a person is a key property of cognition of the world and life. It allows you to fully understand reality. And this property is inherent in man by nature itself.

Abstraction (abstractio - distraction) - the position of the focus of a person's attention, a look at the situation (a person, an object, etc.) from the third position of perception, setting oneself outside the situation, above the situation. Abstraction is carried out in two steps: on the one hand, it is distracted from small, insignificant details, on the other hand, it concentrates on more general and more important things.

As a metaphor: you can look at an object close up - and you will notice a lot of small details, and if you put the object away - small details will not be visible, but it is easier to consider the general outlines and shape of the object.

The result of abstraction is called .

Concept series

Abstraction is the opposite. If abstraction is a removal from the subject under study, then concretization is the opposite: approximation and highlighting the smallest details.

For example: I will lead healthy lifestyle life - common words and abstraction.

I will do exercises for 15 minutes a day and douse myself with cold water every day - this is specific.

Abstraction Goals:

  • Identification, search for commonalities. In this case, those signs that distinguish one object (situation, person) from another fall out of the focus of attention, and attention is focused on what is common between them.
  • Generalization and systematization. In this case, on the contrary, the key differences fall into the focus of attention, according to which objects can be divided into independent and easily distinguishable groups. For example, I have a specific goal for the day, but there are 30 days in a month, and if I generalize the goal for every day, I get a goal for the month. Months add up to a year - we summarize the goals for the month and get the goals for the year, and so on.
  • Clarity and specificity of wording. In this case, the focus is on a certain concept - and only what it means. Everything else is out of focus. For example, if I say the word "growth" - I mean only the process of quantitative changes, when I say "development" - strictly the process of qualitative changes. In this case, the task of abstraction is to separate concepts: what means what and where are the boundaries of one concept, where is another.
  • Sample creation. If I am interested in a certain quality of an object, which I take as a starting point, I consciously single out it and bring it, exaggerating, to the "purity of the equivalent." That is, I know for sure that real world such a quality cannot exist in its pure form - but I deliberately introduce it in order to have a sample (or starting point, from which we proceed). For example, Euclid He based his geometry on the primary terms “point”, “line” and “plane”, which, in the sense that Euclid understood them, do not exist in the real world.

Why abstraction is needed

Setting goals for life

In life, abstraction helps to set a general direction within which it is already possible to formulate specific goals. For example, a person determines for himself the general direction of life (see the ways of human life) - and what he will do is already secondary. It is easier and more correct to start with a choice general direction, and complete with specifics to the smallest detail.

Formation of emotional states

For example, abstract from fairy tales and live in reality when necessary, or vice versa.

Today's article will be not very ordinary. In general - I planned to publish an article about the containers that are in. The topic is interesting, it will be necessary to disassemble it. But today I decided to write about something completely different. It became very interesting to me - what is abstraction and abstraction.

This topic came to my mind when I heard the conversations of our chiefs. They don't talk like ordinary programmers. Somehow differently. Abstract. So I decided to learn more about it.

At the word abstraction There are several interpretations, but it will be necessary to list them:

« Distraction in the process of cognition from non-essential aspects, properties, connections of an object or phenomenon in order to highlight their essential, regular features; abstraction.

Theoretical generalization as a result of abstraction.

Something that has lost certainty, concreteness, reality.

Thanks Wikipedia.

There are several more interpretations of the word abstraction, but it will be enough for us to know the three described above. So let's move on.

Exactly abstract thinking allows you to identify the essential properties of the object of observation. But this thinking comes from feelings, that is - you need to try to understand (feel) the object of observation. After such a feeling, the most important thing can be distinguished. It was in order to better highlight the most important properties of objects that I decided to study abstraction and abstraction in more detail. In the process of working on the development of an automated system (at the very beginning), it is important to digress from its non-essential elements and concentrate on the most important ones. It doesn’t always work out, but if it does, it will be very good!

The process of abstraction can be described as follows: it is a mental process in which we select only a few of a certain set of properties of an object - and completely concentrate on them. And to put it bluntly, the process of abstraction can be equated with dreaming. Then, when we dream, we imagine only one thing and do whatever we want with it. As it was said, abstraction is a thought process, the result of abstraction can only be a thought, and not something material.

There are two approaches to abstraction:

Abstraction of empirical psychology - such a doctrine spoke of abstraction, as soon as it was sensual;

The abstraction of realistic psychology, on the contrary, removed the sensory from this process, saying that abstraction is generated by thought.

Examples of abstraction - a mountain can be represented in the form of a tetrahedron. Human - in the totality of its elements (bones, muscles, etc.). By the way, an abstraction is an algorithm (which is very popular in programming).

Yes, a bit of a chaotic article turned out. Perhaps abstraction and abstraction are more complex concepts, at the beginning of this article I thought that they were simpler. Since I am a programmer, I have abstract thinking. Since childhood, I could only concentrate on some properties of an object (forgetting about the rest). But we need to somehow improve this process so that we can fully control it. So, from today I will study it. As I read on the Internet, there are special exercises that help to think abstractly. I'll try to find them. Stay tuned - it will be very interesting!

) in order to highlight their essential, regular features. The result of abstraction is abstract concepts, for example: color, curvature, beauty, etc.

The need for abstraction is determined by the situation when the differences between the nature of the intellectual problem and the being of the object in its concreteness become apparent. In such a situation, a person uses, for example, the possibility of perceiving and describing a mountain as a geometric shape, and a moving person as a certain set of mechanical levers.

Types of abstraction

Some types of abstraction:

  • primitive sensory abstraction- distracted from some properties of an object or phenomenon, highlighting its other properties or qualities (highlighting the shape of an object, abstracting from its color, or vice versa). Due to the infinite diversity of reality, no perception is able to cover all its aspects, therefore, a primitive sensory abstraction takes place in every process of perception and is inevitably associated with it.
  • general abstraction- gives a generalized picture of the phenomenon, abstracted from particular deviations. As a result of this abstraction, common property investigated objects or phenomena. This type of abstraction is considered the main one in mathematics and mathematical logic.
  • idealization- replacement of a real empirical phenomenon with an idealized scheme, abstracted from real attributes that are not essential for this study. As a result, the concepts of idealized (ideal) objects (“ideal gas”, “absolutely blackbody”, “straight line”, etc.)
  • isolating abstraction- is closely related to involuntary attention, since the content on which attention is focused is highlighted.
  • abstraction of actual infinity- distraction from the fundamental impossibility to fix each element of an infinite set [ ] , that is, infinite sets are treated as finite [ ] .
  • constructivization- distraction from the uncertainty of the boundaries of real objects, their "roughening".

By goals:

  • formal abstraction- highlighting such properties of an object that do not exist by themselves and independently of it (shape or color). This type of abstraction serves as the basis for children to acquire knowledge that describes objects according to their external properties, which serves as a prerequisite for theoretical thinking.
  • meaningful abstraction- isolating those properties of an object that in themselves have relative independence (a cell of an organism). This type of abstraction in students develops the ability to operate with them.

abstract and concrete

Abstract thinking involves operating with abstractions (“man in general”, “number three”, “tree”, etc.), concrete thinking deals with specific objects and processes (“Socrates”, “three bananas”, “oak in the yard ", etc.). The ability for abstract thinking is one of the distinguishing features of a person, which, probably, was formed simultaneously with language skills and largely due to language (for example, it would be impossible even to mentally operate with the “number three” at all, without having a specific linguistic sign for it - “three ”, because in the world around us such an abstract, unattached concept simply does not exist: it is always “three people”, “three trees”, “three bananas”, etc.).

Definition through abstraction

Definition through abstraction- a way of describing (highlighting, “abstracting”) the properties of objects that are not perceived sensually (“abstract”) by setting a certain relation of the type of equality (identity, equivalence) on the subject area. Such a relation, which has the properties of reflexivity, symmetry, and transitivity, induces a partition of the subject area into non-intersecting