Debugging code - Introductions

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

Rick Cook

Everyone knows that debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it?

Brian Kernighan

If debugging is the process of removing software bugs, then programming must be the process of putting them in.

Edsger Dijkstra

I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.

Maurice Wilkes

Avoiding bugs

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Martin Golding

Best advice in debugging is to avoid making bugs in the first place.

Write your code with testing and debugging in mind.


In [ ]:

We all write buggy code. Accept it. Deal with it.


In [ ]:

Write your code with testing and debugging in mind.


In [ ]:

Keep It Simple, Stupid (KISS).


In [ ]:

What is the simplest thing that could possibly work?


In [ ]:

Don’t Repeat Yourself (DRY)


In [ ]:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.


In [ ]:

Constants, algorithms, etc…


In [ ]:


In [ ]:

Try to limit interdependencies of your code. (Loose Coupling)


In [ ]:

Give your variables, functions and modules meaningful names (not mathematics names)


In [ ]:

Use static code analyser's


In [ ]:
- pylint
- pychecker
- pyflakes
- flake8

In [3]:


In [ ]: