The art of problem solving in Software Development

Or, how to be a programmer without going nuts

Alessandro Roaro
Elty by DaVinci Salute
11 min readApr 24, 2024

--

Solving problems is an art, period. It may seem like something completely boring and frustrating and it can definitely be that way, but it depends on the attitude. So, because we want to be good programmers and not go insane while doing it, we shall do our best to become masters of this art.

Making friends with the enemy

Sometimes we have the naive idea, especially as beginners, that the process of software development is all about building stuff, adding nice new features and so on, and that problems — like bugs for example — are a sort of hindrance, something annoying that shouldn’t happen in the first place. While it’s true that we should try to avoid introducing problems as much as possible, they will inevitably be there as part of the process. So, for the sake of our mental health, we should first of all try to make peace with that and accept it. Otherwise, every time we are faced with an unexpected bug we will feel resistance towards it. We will think, “ah, this shouldn’t happen. It’s really annoying. I don’t want to waste my time fixing this, I should be implementing that nice new feature that is so much needed”.

Seeing the problem that we have to solve as an actual problem is the real obstacle, not the problem itself. We should try to recognize and dismantle our conceptualized negative view of what a problem is, which places us in a position of resistance. We feel that we are not moving forward and that we are stuck, while in fact it’s part of the process and we are moving forward in any case. A problem doesn’t exist as a problem on its own side, but it’s our imputation on it that defines it as a problem — something negative that we don’t want and that makes us feel uncomfortable. This is true for software development but also for life in general: for instance, a person may consider a problem not having any money, while for another person it could be a problem having money because of the hustles related in dealing with it (although definitely a much more rare case, it exists: monks for example). So a problem is relative to one’s own view and it doesn’t exist in an absolute way. We have the innate, deeply rooted tendency of making separations between things, by either judging them attractive or repulsive — but still, that’s just our own imputation. We project them to be some sort of independent entities with absolute qualities.

To put it into practical terms: solving a problem it’s just an activity, which is composed of different aspects and various parts, and is itself part of the largest activity or process of programming. By judging it as a whole as something unwanted, we put a sort of filter on it which taints our experience, and doesn’t even allow ourselves to make something good out of it — to play with it, to let our creativity flow into that. There is a possibility of playfulness in everything, and we should re-learn this from children: even the most flat and insignificant thing can become a source of inspiration. Instead, we cut that possibility at the root: we’d rather complain and remain in our misery. This is the enemy that we should make peace with, and then we will also be at peace with solving any problem whatsoever.

The bug-hunting game

I spent the past 6 months at DaVinci Salute (Elty) working solely on fixing bugs and doing refactoring. We had arrived to a point where our product was quite consistent of features and so we decided to focus on improving stability, and that we would take all the time that was necessary for this. Was it fun? No. Would I have rather developed some nice new features? Yes, but thinking that way doesn’t help with coping with the situation. So I just accepted the fact that I had to fix a lot of bugs, and that they were the result of the technical debt that we had accumulated due to our previous speeding up in the implementation of new things. I did my best to welcome it as a great opportunity to be face to face with the “enemy”, without any possibility of side tracks, and to commit to finally making peace with seeing problems as problems.

Actually, there can be much creativity involved in the process of bug fixing. It’s like being a hunter. You study the tracks of that nasty bug, taking the dirt in your hands and smelling it, to get acquainted with the beast. You sit patiently, considering all the possibilities and really being open to anything, without quickly jumping to conclusions. You have no hurry to catch the pray. You can wait. Yes, you are hungry, but you sit there cold-blooded, hiding behind your bush, patiently waiting and analyzing, studying the situation. If you start rushing and jump out of your bush, you will scare the prey (the bug) and you will find yourself desperately trying to chase it by running after it, only to make you tired and frustrated very soon. It’s really all about the attitude: if you are having a hard time understanding the problem and you start to think that it doesn’t make any sense, that it shouldn’t happen, that it’s so annoying and so on, you have become the prey. The code is always right.

So, better to wait behind the bush, reflecting and studying the situation thoroughly, but also allowing ourselves the possibility of tasting the quality of this meticulous and patient search. By connecting to this quality we discover that patience is something quite refined, something that allows for space, and that we can develop it and carry it with us in everything we do. Since we have to fix bugs in any case, it’s better to try to make something good out of it and to develop patience and not frustration. If we are skillful hunters, eventually the prey will come to our bush.

Knowing when to quit

A real champion knows when it’s time to quit. I don’t mean necessarily programming as a job, although that could be the case for some… what I mean is that when we are trying to solve a problem and we really can’t make any sense of it — we believe that we have looked into all the possibilities and we just can’t figure out what could go wrong — it’s pointless and also counterproductive to just keep trying. We would just keep spinning in circles. We are tired, frustrated, and the best thing we could do is simply move on to something else and do our best to forget about it. Possibly we should leave our desk and do some non-mental activity. Quite possibly we should get a beer. A part of us would want to stay there and keep trying, feeling so close to solving the problem, but most of the time this is a sort of attitude that comes from not accepting to lose.

By quitting we are not losing, we are just being smarter: we will go back to the problem some other day, with a mind that is more fresh and broad. What happens when we fixate too much on something is that our perspective tends to get narrow. That’s because we think that we already know what the problem should be, or at least where it should be. So we look and look but always in the possibilities that our perspective allows us to see. We should instead come back to the problem with a beginner’s mind: then we have got rid of our beliefs about knowing what the issue should be, and we are really open to anything.

In the beginner’s mind there are many possibilities, but in the expert’s there are few. — Zen mind, beginner’s mind (Shunryu Suzuki)

To make an example from my personal experience, a few months ago I was confronted with a bug of which I just couldn’t make any sense. I spent days on it. Looking and looking, analyzing the logs, trying to figure out what the hell could go wrong. It was very mysterious. Then, I went on vacation for a couple of weeks (it was Christmas time) and when I came back, it took me 15 minutes to find the problem and to solve it! And that’s not because I had been thinking about it while on vacation, not at all, or because in the meantime I got twice as smart. I had simply forgotten all about it and so I was looking at it from a much broader perspective, with no expectations of what the problem could be related to. On top of this I was also more relaxed and I didn’t even care so much about solving the bug in a quick way, in order to move on to something else.

Just another bug fighting match (AI generated pic)

When work is done, is done

When work-time is over and we shutdown our computer to leave our desk, we often don’t also leave our work-related problems there. The tendency is quite the opposite: the tasks that we faced during the day and especially the ones that we didn’t complete yet continue to occupy our mind, as if we didn’t entirely move away from them. We keep ruminating on them. “This thing I could have done it in this way, that other thing I could do it in that way”… A part of us is still in the process of analyzing, searching for improvements and possible solutions. Maybe we will have the devilish temptation to re-open our laptop to apply a “quick fix” that popped into our mind, or to go back to some problem for which we had a new idea. Of course sometimes it’s alright to do this, but it’s often necessary to mark a clear boundary where we define “stop” to work. This is particularly true for those like me that work remotely and can do it at anytime. But even if we put a stop to work, it’s not obvious that we also put a stop to our work-thoughts.

Why does this happen? It’s very subjective and it can depend on many reasons. Often something unresolved is bothering us and we want to find a way out. Or maybe we just care about the quality of what we do and so, because we want to improve ourselves, we carry on a sort of “replay” of our day. Perhaps this is done through a negative perspective because we weren’t satisfied with ourselves and we want to push ourselves. Or again, possibly we have some kind of aesthetic ideal of perfection and we want things to fall in place as soon as they can, like trying to finish a puzzle ASAP for the sake of the taste of completeness.

Why isn’t that good? In any case, whatever the reason, I believe that it’s beneficial to recognize as counter-productive this tendency of bringing work in our minds even when it should supposedly be over. It does not allow ourselves to truly rest — because there is still intense mental activity going on — and to regenerate in order to start fresh the next day. What happens instead, is that those thoughts will continue to stick in our heads and we will carry them during the evening, whatever we do, and somehow also while we are sleeping. It’s as if the metaphorical hand of our mind is still grasping and not letting go. We may think that this will help us go back to our task the next day, but actually we will be more tired and less productive, because we haven’t fully relaxed. On top of that, by letting go and “making space” we are able to gain some distance from things and that will help us to have a broader perspective. As I said before, when we focus too much on something then our perspective tends to get narrow, and quite possibly we will put too much attention on the details, losing sight of the bigger picture. Both views are necessary to face a problem in an effective way: the bigger picture and the tiny details, but we must be able to refresh our minds in order to zoom in and out.

Another interesting aspect is that whatever we do shapes our minds. Whether we are programming, talking, dancing or scrolling social media, we are training our minds at that specific thing and so the thoughts that we will have will also be influenced by that. The more we dance, the more our mind (and body) gets accustomed to that. The more we scroll through Instagram, the more our mind will be occupied by things we see there and the more it will crave that. The more we solve problems, the more it will come natural to us. The downside is that, as programmers, we may have the tendency to apply this forma mentis to life in general, more or less unconsciously trying to solve life as if it were a problem.

Life is not a problem to be solved, but a reality to be experienced. — Soren Kierkegaard (but also, Dune)

How to stop the hamster from running wildly on the wheel? Because programming is such a mentally intense activity, it’s wise to direct our attention to some non-intellectual activity when we are not doing that. Otherwise we will still be in our heads, and we will probably have a hard time not following those work-related thoughts that we want to get rid of. Each one of us has different characteristics and we should find out what is more effective for ourselves: doing physical activity in order to get back in touch with the body, playing an instrument in order to dive into music, cooking some delicious food to be overwhelmed by the senses… we may feel tired after work and that could make us lazy. Possibly we just want to be brain-dead in front of a TV screen. But actually that weariness is just mental: if we are able to redirect our attention to the body then we will be able to restore the natural flow of energy.

It takes time to experiment ways to find balance. Many times we will become stressed and overwhelmed, and the sailor will lose the control of the boat, so to speak. That’s also probably a sign that we have pushed ourselves too much. Speaking for myself, finding balance has been a long way, along which I have met many allies that allow me to let go of the wrinkles accumulated during the day. I use them according to my mood and needs: playing music, walking, or doing yoga and meditation. In particular, meditation is a great tool to calm down the mind and to develop inner stability. I practice it at least once a day before starting to work, and that allows me to create a space of calmness that I can carry throughout the day, and to which I know that I can always go back if the waters become agitated.

Conclusion

Programming has its own difficulties, like any other job or activity. My aim here was to share some insights that have helped me to face these difficulties and to turn them into something positive, during the past 10 years of software development. Actually, by writing this, I realized that I am grateful for having had these difficulties, which forced me to find ways to deal with them in a sane way in order to find balance in the daily life. Thank you for reading this article, I hope you found it useful.

--

--