Member-only story

Find and Fix Bugs Like a Pro With Divide and Conquer

If I could learn only one thing about debugging, I’d learn to divide and conquer

Szymon Adamiak
Better Programming
4 min readMay 18, 2020
Debugging is like playing hide and seek. Photo by Artur Rutkowski on Unsplash.

Divide and Conquer

Divide and conquer is an algorithm design type. It works by recursively breaking a problem in two (or more) smaller problems of a similar nature. If you can solve the little issue, you can solve a bigger one too. Divide and conquer is used primarily for sorting or finding the closest pair of points.

But divide and conquer is more than that. It’s a mindset you can use to debug your apps.

Debugging

Debugging is a tiring task for many developers. You need to know your intended inputs and outputs. You need to understand the code and the flow of the app. Often finding a mistake is much harder than fixing it.

Countless programmers hate debugging for another reason. We prefer making things than fixing them. It’s a lot more satisfying to create new code than to spend half a day seeking an error and finally changing two lines.

The naive approach to finding bugs is going through the code line by line, logging data, or setting breakpoints. You can use that in trivial apps or if you know almost exactly where the mistake is.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Szymon Adamiak
Szymon Adamiak

Written by Szymon Adamiak

I build stuff and help frontend developers to grow careers. Let’s become better developers together! https://www.youtube.com/channel/UCwH-rpV-nJ5H5xahPWBwAeg

No responses yet

Write a response