What is hard is truly understanding the errors you get, and truly understanding what's the best solution for them. While there are many tools that can help you with debugging, using these tools isn't necessarily the hard part. Usually it takes a combination of googling, logging our code, and checking our logic against what is really happening. Then we correct it and ensure it won't happen again. Usually we'll start by thinking out all possible causes, then testing each of this hypotheses (starting from the most likely ones), until the ultimate root cause is found. How to Debug Your Codeĭebugging can be defined as the process of finding the root of a problem in a code base and fixing it. And from there on, it's easy to give the wrong instructions to the computer and miss the target we're looking for.Īn inside joke in the software development world is that devs normally spend 5 minutes writing code and 5 hours trying to understand why things don't work as they should.Īs developers, no matter how good we get, we're going to spend countless hours debugging our code, so we should try to get better and quicker at it. Programming can be a very abstract activity, and it's really easy to quickly lose sight of what's the actual task the computer is performing, or what information we're acting upon in a certain line of code. These provide levels of abstraction from the actual tasks the computer is performing, and representations of the information we're managing. To interact with and make use of computers, we use programming languages. Within the computer there're only electric pulses, that are then abstracted to 1s and 0s, and then again abstracted into whatever information we're working with. Information isn't "actually" there within the computer, at least not in the format users think of it. We work with information all the time, but not directly with it. We organize it, move it, update it and edit it, send it places and then receive it again. Why Should You Learn About Debugging?īugs and errors are so prone to happen in software development because it's such a conceptual and abstract activity.Īs developers, we work with information. Thankfully, however, the cases were we need to remove actual insects from computers are rather rare, now. It has always been and it probably always will be. The point is that debugging is a core part of software development. If you're a fan of etymology though, you might be interested in the fact that the word "debugging" seems to have been used as a term in aeronautics before entering the world of computers.Īnd apparently there's some kind of proof that even Thomas Edison used it in the sense of "technical error" back in 1878.īut that's not the point of this article. When fixing this problem, she remarked that they were "debugging" the system. In the 1940s, while she was working on a computer being developed for the US navy at Harvard University, her associates discovered a moth (an actual insect) stuck in a relay that crashed the computer. A true legend, she wrote the first compiler that ever existed. The words " bug" and " debugging" in software are popularly attributed to Admiral Grace Hopper. Take a Break and Think about Something Else.Narrow Down Your Problem and Understand Where the Error is Generated.Explain Your Logic to Another Person or a Duck.In this article we'll talk about what debugging is, how to debug your code, and how you can get better at it.
0 Comments
Leave a Reply. |