Over 2,000 mentors available, including leaders at Google, Amazon, Netflix, and more. Check it out

Intuitive programming

During my work experience, I quite often heard the phrases of experienced and novice programmers - “I feel that this should work”, “I have a feeling that this method will not work”, “Let's make an intuitive clear interface" and so on. All this is a manifestation of intuition in the development and programming process.
Andrew Nester

Senior Software Engineer, Databricks

To begin with, I would like to define the very concept of "intuition".
Based on Wikipedia, 
  • 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"
The basis of these definitions is that intuition is a certain way of making a decision. There may be several grounds for this method: it is previous experience, imagination, and irrational "sense", etc. And each of these ways is reflected in the programming process, and can have both a positive and a negative impact. Therefore, first of all, I would like to divide "intuitive" programming into 2 components: - optimistic and pessimistic.

Optimistic instinctive programming

Its essence lies in the optimistic or positive influence of intuition on the process of creating code. In this case, intuition is an assistant, a "good friend", a tool in the developer's hands.

Intuition based on experience

The main idea here is that in the process of accumulating development experience, we develop certain stereotypes, associations associated with the code, which we are able to determine without deepening into the thought process.
I would like to offer you an example-experiment. Below is an example code in Sidef language (I hope not many of you know it :)). Try not really delving into the details, guess what it is:
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

AnswerThis is the classic bubble sort.

Perhaps some of you guessed what it was about by seeing familiar parts in the code, maybe some not. I tried to conduct this experiment on a small group of my fellow programmers and the result is that more than half (about 65%) of people were able to understand what was at stake in a very short time. I asked them how they could guess - and the most popular answer was:
“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

Try to continue the next row:
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.
This is due to the fact that we analyze the names of functions, compare them with the result obtained, and thus build some patterns, assumptions about the analyzed code. Thus, we connect our intuition, supported by logic, to read such code.

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

And now I would like to move on to such a frequently used expression as “an intuitive interface”. This applies to both the software and the user interface. Given the above points, we can say that an intuitive interface is an interface that meets the expectations of the user, whether it be a programmer or an end user. These expectations are formed on the basis of 2 components - our previous experience and logical patterns and assumptions. If all the pages of your website had the menu on top, but on the Feedback page the menu was on the left, then the end user might get a little confused because "his intuition" tells him that the menu should be on top. But why is it that sometimes when we visit a website with an original design or a new mobile application, we get the feeling that this site looks cool or terrible?

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

But intuition can also be negative in development.
As mentioned above, "irrational" intuition is both a lifesaver and a dangerous tool in the hands of a programmer. Based on such instinctive decisions, we lose confidence in the code we write, in which “magic” begins to happen.

Importantly, such decisions create some level of anxiety when making subsequent decisions. The predominance of feelings, sensations, and irrationality during development leads to the impossibility of justifying everything with the help of logic, and as a result, complicating the understanding of the code, loss of readability.

As a conclusion

In general, the issue of intuition in software development is not raised for the first time.
This is due to the fact that the problem of the influence of processes that are not related to logic and thinking on the process of writing code will remain relevant, since this process is occupied by a person with feelings, prejudices, "irrational".

Find an expert mentor

Get the career advice you need to succeed. Find a mentor who can help you with your career goals, on the leading mentorship marketplace.