Bugs & Errors In Programming

Steven Klavins
3 min readFeb 18, 2020

Week 1 — Debugging

Error error error…

If you have ever taken a dive into the world of programming you will know it’s inevitable you will encounter compiling errors, syntax errors and all in between. It is a struggle and can sometimes make you want to throw your computer across the room, we have all been there and no doubt will be again.

But fear not, since this is a common struggle for all programmers there is a number of ways we can get over this hurdle. Now, before you run over to stack overflow to outright ask someone for the solution consider the following first;

Have you clearly read the error message? Typically most IDE’s will specify on which line the conflict is occurring. Track down that line and analyse the message. For example;

rb:9:in `block in <main>’: undefined method `bool’ for main:Object (NoMethodError)

Here we can see the message specify the error occurs on line 9 in the main class, it states we have a undefined method named ‘bool’. Carefully check your syntax to ensure you have not made any typo’s, it really can be something simple as that. Trying to break down the error into small pieces can always help, resolve what you know you can fix first, then move onto the next issue.

Now what if your still baffled by the error, this is where are good old friend Google comes in. Try searching for the key words, for example “Ruby, undefined method, NoMethodError”. If you have no joy searching for this, phrase the search as a question, example “What is a undefined method NoMethodError in Ruby?”

So if your still stuck at this point another solution is what some may refer to as rubber ducking.

The Wikipedia definition of rubber ducking is as follows:

“In software engineering, rubber ducking is a method of debugging code. A programmer debugs their code by forcing themselves to explain it, line-by-line, to a rubber duck.

“Many programmers have had the experience of explaining a problem to someone else, possibly even to someone who knows nothing about programming, and then hitting upon the solution in the process of explaining the problem. In describing what the code is supposed to do and observing what it actually does, any incongruity between these two becomes apparent. More generally, teaching a subject forces its evaluation from different perspectives and can provide a deeper understanding.”

Try diagramming your code, sometimes having a visual representation of your programs life cycle can help, for example here is the life cycle of an android app.

List your assumptions about the life cycle of your program, what action should be executed at what point, piece by piece go through your code and ensure all your assumptions about its functionality are correct.

Now finally if you are still bogged down with errors it may be the time to reach out for help, however ensure you ask the question in a clear detailed manner. Ensure you include the error message and the code the issue stems from, screenshots and an explanation of what your trying to achieve will help greatly.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Steven Klavins
Steven Klavins

Written by Steven Klavins

Hi, I’m Steven, most call me Steve! I’m a programmer, musician, and artist. This blog contains various tutorials and posts related to software development.

No responses yet

Write a response