DEV Community

Cover image for Solving Problems By Guessing
Michael Brizic
Michael Brizic

Posted on • Updated on

Solving Problems By Guessing

I think that we shall have to get accustomed to the idea that we must not look upon science as a 'body of knowledge,' but rather as a system of hypotheses; that is to say, as a system of guesses or anticipations which in principle cannot be justified, but with which we work as long as they stand up to tests, and of which we are never justified in saying that we know they are 'true' or 'more or less certain' or even 'probable.'
-- Karl Popper

Karl's quote not only applies to explanatory knowledge but is equally as important regarding science that includes the solving of particular problems.

Software development is definitely a part of that science. Guessing is how I, and many software engineers, find a working solution to the various problems that arise. Indeed, almost anyone trying to solve a problem uses some form of guessing to some extent. There is absolutely nothing wrong with the educated guess. In fact, more often than not, I have no absolute answers at all and am guessing at almost every problem that arises.

Recently, I have had the pleasure of upgrading a Java web server to compile and run on version 17. The original version upon which it was based is 11. This type of work usually requires a significant amount of time due to the longer feedback loop of having to not only pass compilation, but also all test suites, including running the app.

I manage to get through the aforementioned gates on my local machine, a MacBook Pro. I open a pull request for the team to review and let the CI pipeline do its thing. It fails. Many of the integration tests are causing the build to fail. There's a problem, and it has to be solved. Am I instantly conjuring up stored knowledge that succinctly solves the problem? No.

Immediately, the guesswork begins. Questions come to mind in the form of hows and whys. All a very natural part of the process. Much of it in the beginning is in the form of wild finger-pointing, mostly at oneself. Did I forget X? Is something wrong in the way I merged and kicked off the build? Bad parameters? But how did everything work locally? Must be an environmental issue. Is my local environment off? How is my local environment different from the CI pipeline's environment?

As one reflects, and questions the source of the problem, some questions will appear more likely than others. Selection among the candidates is the logical next step. Which of the thoughts, the questions, the guesses does one pursuit?

This is exactly how many problems are solved: creative guessing followed by selection and testing. Realize there is a problem, start wondering at how or why it is a problem, select among the guesses as to which one it might be, and then test whether the guess is valid and leads one towards identifying the problem. It is very rare that I draw upon some stored knowledge whereby I'm able to immediately and definitively answer or solve a problem in an instant.

Of course some guesses are going to be better than others, and have a higher probability at determining the source of the problem and how to solve it. This is essentially the meaning behind the oft-repeated apothegm of take an educated guess. So it's not just that one is guessing but that one is using prior knowledge and experience to inform the guess. One may even be using instincts (but perhaps informed by past experience). Frankly, there are times when one's guess is informed by others. This too, is an educated guess, just not necessarily educated by oneself. Other people, or knowledge sources, don't have 100% of the problem context but can provide insight with some level of surety that perhaps their knowledge and experience will identify the problem source and a path to a solution, having studied or solved something similar in the past.

Usually wild and ridiculous guessing is not really fruitful. Certainly there are times when spit-balling is useful and necessary such as when one doesn't even know where to begin or has had no prior experience or knowledge within a given problem context. And, random, uneducated guessing has proven itself able to solve problems, since this approach can potentially lead to unorthodox thinking and discovery. Rather, the educated guess, guessing with human creativity, instinct, or intuition, is going to be more efficient and effective. And thus one tries to use all previous knowledge one has acquired including any and all experiences to build a set of potential, testable guesses. Before even trying one of the guesses it's worthwhile to think them through. The so-called thought experiment is useful during the process. One might test the guess inside one's mind before even trying it in reality. Absolutely put the guess to a test in reality if thought experiments don't yield progress due to challenges of the problem context. This must be done eventually anyway. Thought experiments may be helpful in reducing the amount of time one spends selecting from among the set of guesses.

Testing cannot be overemphasized enough. It is without exception, necessary. For making educated guesses will always remain open to error correction. And this is the portion related to the practice of science that underscores the rarity of it being 100% absolutely correct for all of time. Guessing is the way, but fallibilism in the guesses must be accepted, and tolerated. Even after one has tested one's most cherished guesses, there could be any number of other factors that come along at some point and prove the guesses incomplete, or simply wrong.

First you guess. Don’t laugh, this is the most important step. Then you compute the consequences. Compare the consequences to experience. If it disagrees with experience, the guess is wrong. In that simple statement is the key to science. It doesn’t matter how beautiful your guess is or how smart you are or what your name is. If it disagrees with experience, it’s wrong. That’s all there is to it. -- Richard Feynman

In summary, guessing is an important part of science, notwithstanding, in solving problems. It's the educated guesses that usually yield more efficient and effective success although uneducated guessing sometimes works by revealing fresh ideas. Creative guessing is harder and requires more thinking to narrow the applicability to the problem. And guessing is not the complete process as one must also think with knowledge in order to select among the set of guesses which will likely be correct. Lastly, all guesses must be tested. The testing is sometimes done in one's mind playing out scenarios against outcomes. However, subjecting one's guesses to physical testing is required. In many cases, continual testing must be done to ensure that one's guess hasn't missed some part of the picture, or correct various errors that aren't always apparent initially.

Top comments (0)