DEV Community

Discussion on: Debugging Tips and Tales

Collapse
 
erebos-manannan profile image
Erebos Manannán

One of the most important things that is still missing from this imo is "know when and how to ask for help".

A lot of people think they're alone with their problem to debug and so it becomes a much bigger source of stress etc. than it needs to. However, quite a lot of people have the comfort of working in a team and being able to ask for help from team mates, and there's Stack Overflow, GitHub issues, IRC channels, and Slack for many projects, if you can first identify roughly what you're having an issue with.

If you've spent actual effort trying to figure out what's wrong, you have an idea of what is going on and what's wrong, but don't yet know how to solve it, is usually a good time to start asking for help. If you're at the stage where literally all you know is "it doesn't work" where you're not even sure what "it" or "doesn't work" mean, then it's too early.

Once you've figured out you need help, the next hurdle for people really is "how to ask good questions". Most people are really bad at this, because they just don't practice at all. They never ask for help, they never visit forums, or other discussion mediums to ask for help, nor ask for help from their colleagues.

Explaining what is wrong to another person takes effort, and you can't just throw them a disconnected snippet of what YOU have been looking at, or the last line of a traceback saying "this is broken". You should at least explain what you've been trying, what kind of issue you're having with it, how you've tried to debug it, and what kind of errors you're seeing.

E.g. a bad "explanation" of your problem (that I encounter depressingly often) is like:

I'm getting "TypeError: object of type 'NoneType' has no len()", what's wrong?

Whereas a better one would be more akin to:

I've been trying to run the database migration task for my local environment, but it's giving me errors. I checked and it seems the configuration is correct, and the database server is running, but for some reason I'm getting this really odd error that seems to have something to do with the database connection based on the traceback.

Here's the full traceback:

File "/src/tasks.py", line 15, in <module>
    from app import services, models
  File "/src/app/services.py", line 12, in <module>
    import common.utils as utils
  File "/lib/python/common/utils.py", line 264, in <module>
    db = get_db(_ARANGODB_DB)
  File "/lib/python/common/utils.py", line 225, in get_db
    _ARANGODB_PORT, CustomHTTPClient(_ARANGODB_PROTOCOL))
  File "/lib/python/common/arangodb_client.py", line 26, in __init__
    self._session.mount(protocol, adapter)
  File "/.venv/auth-ALEBwC_u/lib/python3.6/site-packages/requests/sessions.py", > line 744, in mount
    keys_to_move = [k for k in self.adapters if len(k) < len(prefix)]
  File "/.venv/auth-ALEBwC_u/lib/python3.6/site-packages/requests/sessions.py", > line 744, in <listcomp>
    keys_to_move = [k for k in self.adapters if len(k) < len(prefix)]
TypeError: object of type 'NoneType' has no len()```



Also you should understand netiquette if you are asking people on forums or Slack or similar. Use a kind tone, write full coherent sentences instead of using the Enter -key for punctuation, and try to make sure you're posting in the right place.

In case of Slack, you probably shouldn't be posting to #general, but instead most projects have #troubleshooting or #help -channels. In Stack Overflow try to keep your questions clear, to the point, and with appropriate tags. In case of both IRC and Slack you should realize that these are not a 24/7 paid support, it's people with other things to do in their lives and you might have to wait for a long while (often hours) and maybe even repeat your question a few times (or rephrase it) before you get a reply.

Collapse
 
markerikson profile image
Mark Erikson

Yep, good advice!

There's plenty of "how to ask good questions" articles out there, but unfortunately folks that are likely to ask "bad" questions are also unlikely to be searching for info on how to ask better questions :)