**Intuition***(from lat. intuitio - “contemplation”, from the verb intueor - I look closely)*is a method of solving problems through a one-time subconscious conclusion based on imagination, empathy and previous experience, “flair”, insight.**Intuition***(from lat. intueri - to look closely, carefully)*is a thought process consisting in almost instantaneous finding of a solution to a problem with insufficient awareness of logical connections.**Intuition***(from lat. intueri - look closely, carefully)*- knowledge that arises without awareness of the ways and conditions for its receipt, due to which the subject has it as a result of "direct discretion"

## Optimistic instinctive programming

### Intuition based on experience

loop { var swapped = false { |i| if (arr[i-1] > arr[i]) { arr[i-1, i] = arr[i, i-1] swapped = true } } * arr.end swapped || break } return arr

**Answer**: This is the classic bubble sort.

*“We saw familiar pieces of code and immediately assumed what it was.”*

Thus, by accumulating experience, our brain is able to very quickly, without additional mental effort, make decisions regarding the code with which we work. It is because of this that it seems to us that more experienced programmers have a certain “feel” about the project or any programming language.

### Intuition based on logic

1, 3, 5, 7, 9, 11, ...

Surely you have not thought for a second what number will be next. This is a simple example of a pattern that we can literally continue without thinking. But what if we take the following piece of Python code as an example:

def sum(a, b): ... def mult(a, b): ... def subtract(a, b): ... def divide(a, b): ... def calculate(a, b, strategy): ... calculate(4, 2, sum) #6 calculate(4, 2, mult) #8 calculate(4, 2, subtract) #2 calculate(4, 2, divide) #??

Even without seeing the source code, we “intuitively” feel what the result of executing the last function in the list will be.

Here I would like to note that the code that corresponds to our assumptions, our intuition, we usually call "readable", "understandable" code. This is due to the fact that we use not only the resource of our brain, but also our intuition, thereby making it easier to read and understand the code.

### Intuitive interface

### Intuition as irrational

The basis of such a judgment is that often intuition is born as just a feeling of something, not supported by any conclusions, logic or experience. This kind of intuition is the most dangerous in development, but at the same time it is a way to quickly solve complex problems. This is exactly what is called "magic" in programming - we change the value of one variable or flag and miraculously our code starts working, although this decision was made absolutely instinctively. And just this kind of intuition is its true manifestation.

Pessimistic instinctive programming