What do you do when trying to fix a problem?

What do you do when trying to fix a problem?

Postby mckryall » Tue May 27, 2014 4:32 am

When coding, everyone, eventually, has bugs in their code. Bugs can be caused by anything from forgetting a close-paren to accidentally typing on a Dvorak keyboard to compiling your .py file with the wrong flags, or even defining a function with sheep's blood instead of goat's. Many people have run into these problems, and, as with any task that a large group of people undertake, there are many approaches used. Some people scream at their code until it fixes itself, and others sacrifice a keyboard key to the Python gods. Still, others actually try to read and write code. Many have been tortured or even executed as a result of committing this heresy. We, we chosen few, have decided to follow this dangerous path and interact with the dark, Pythonic magic. So, now, I call to you and ask this heretical question: How do you go about trying to fix bugs?
...
No one?

...

Alright. I'll start. I like to read my code and follow the data from input to output to make sure that all the right dark rituals are being used on it.
Now, you go.
...
Python 2.7
Mac Mini
Laptop w/ Ubuntu 14.04
Steam; PSN
mckryall
 
Posts: 101
Joined: Sat Nov 23, 2013 6:13 pm

Re: What do you do when trying to fix a problem?

Postby Kebap » Tue May 27, 2014 10:18 am

I like to add a couple of print commands everywhere, in order to find quickly, which region still works as expected, and where weird values commence. That way, I dodge the need to read every line from top to bottom and follow every variable change precisely.
Learn: How To Ask Questions The Smart Way
Join the #python-forum IRC channel on irc.freenode.net and chat with uns directly!
Kebap
 
Posts: 397
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe

Re: What do you do when trying to fix a problem?

Postby metulburr » Tue May 27, 2014 10:43 am

I also throw prints up in the suspected bug location to start narrowing it down.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1489
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: What do you do when trying to fix a problem?

Postby mckryall » Wed May 28, 2014 12:31 am

I do that too, but ,If I'm completely lost after that, which is probably because I implemented something conceptually wrong, I still need to read through the entire thing.
Python 2.7
Mac Mini
Laptop w/ Ubuntu 14.04
Steam; PSN
mckryall
 
Posts: 101
Joined: Sat Nov 23, 2013 6:13 pm

Re: What do you do when trying to fix a problem?

Postby metulburr » Wed May 28, 2014 1:07 am

imagine if you were working on the linux kernel, by the way the total number of lines for it is like 15 million.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1489
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: What do you do when trying to fix a problem?

Postby lorddarthvader » Wed May 28, 2014 1:02 pm

Steven Wright wrote:If at first you don't succeed, destroy all evidence that you tried.
--If at first you don't succeed, destroy all evidence that you tried.
My github
fite me
User avatar
lorddarthvader
 
Posts: 33
Joined: Mon Apr 07, 2014 11:38 am

Re: What do you do when trying to fix a problem?

Postby XndrK » Tue Jun 03, 2014 6:13 pm

I use an IDE with breakpoints, and work from there. I am not familiar with unit-testing, but if I ever learn it, that will probably come in handy. On the other hand, I'll probably never learn it.
Proverbs 26:14 describes me a bit too well.

Version: Python 2.7.5

https://github.com/4of92000
https://github.com/PythonForum/
User avatar
XndrK
 
Posts: 172
Joined: Sat Jun 15, 2013 7:57 pm

Re: What do you do when trying to fix a problem?

Postby Crimson King » Tue Jun 03, 2014 7:20 pm

Use pdb, not that much, just write a couple of "import pdb; pdb.set_trace()" and see if i can find the problem.
User avatar
Crimson King
 
Posts: 131
Joined: Fri Mar 08, 2013 2:42 pm
Location: Buenos Aires, Argentina

Re: What do you do when trying to fix a problem?

Postby Mekire » Wed Jun 04, 2014 2:27 am

XndrK wrote:I am not familiar with unit-testing, but if I ever learn it, that will probably come in handy. On the other hand, I'll probably never learn it.

Yeah, the mature answer would certainly be unit testing and TDD in general.
But yeah... I certainly don't use it in my projects either (though I often hit areas where I end up wishing I had).

-Mek
User avatar
Mekire
 
Posts: 1008
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan


Return to Bar

Who is online

Users browsing this forum: No registered users and 1 guest