Comments on: Delete bugs and broken code http://compsci.ca/blog/delete-bugs-and-broken-code/ Programming, Education, Computer Science Wed, 30 Sep 2020 08:31:44 -0400 http://wordpress.org/?v=2.8.4 hourly 1 By: web design yorkshire http://compsci.ca/blog/delete-bugs-and-broken-code/comment-page-1/#comment-100367 web design yorkshire Tue, 04 Dec 2007 10:45:53 +0000 http://compsci.ca/blog/delete-bugs-and-broken-code/#comment-100367 Theres some good tips in there. I'm a semi pro web developer, and I find that just getting up, walking away and coming back after relaxing really helps. Its like looking at your code with news eyes, and you'd be suprised how easy it is to spot silly mistakes. I code PHP and find that dreamweaver can sometimes help debugging, if not, just get a friend to check over it :) Keep up the good work on the site too ;) Theres some good tips in there.

I’m a semi pro web developer, and I find that just getting up, walking away and coming back after relaxing really helps. Its like looking at your code with news eyes, and you’d be suprised how easy it is to spot silly mistakes. I code PHP and find that dreamweaver can sometimes help debugging, if not, just get a friend to check over it :)

Keep up the good work on the site too ;)

]]>
By: Bobrobyn http://compsci.ca/blog/delete-bugs-and-broken-code/comment-page-1/#comment-85806 Bobrobyn Wed, 14 Nov 2007 14:52:44 +0000 http://compsci.ca/blog/delete-bugs-and-broken-code/#comment-85806 My prof for Data Structures this year basically said the same thing. People seem to think that if they shorten the number of keys they press, they are doing less work. However, often times it's faster and takes less thought to just rewrite the broken code. The only thing I'd recommend is to make a backup of your broken code "just in case". If it's an assignment being done at the last minute, sometimes handing in code that has a couple of bugs is better than handing in no code, or code that doesn't compile. (Of course, for the real world....) My prof for Data Structures this year basically said the same thing. People seem to think that if they shorten the number of keys they press, they are doing less work. However, often times it’s faster and takes less thought to just rewrite the broken code. The only thing I’d recommend is to make a backup of your broken code “just in case”. If it’s an assignment being done at the last minute, sometimes handing in code that has a couple of bugs is better than handing in no code, or code that doesn’t compile.

(Of course, for the real world….)

]]>
By: James (StealthArcher) http://compsci.ca/blog/delete-bugs-and-broken-code/comment-page-1/#comment-84904 James (StealthArcher) Tue, 13 Nov 2007 05:58:41 +0000 http://compsci.ca/blog/delete-bugs-and-broken-code/#comment-84904 Heh, have had to do this a couple of times on practice programs. I find that McKensie solution works well for me though, as I have never liked to have any options cut off from me. But I find that if something confuses me, leave for a day or two, do other stuff (game on supcomm for example) and come back later. and it all makes sense. Now that I've heard about it, seems that the teddy bear sitting in the hallway will get some attention now ;) . Heh, have had to do this a couple of times on practice programs.

I find that McKensie solution works well for me though, as I have never liked to have any options cut off from me.

But I find that if something confuses me, leave for a day or two, do other stuff (game on supcomm for example) and come back later. and it all makes sense.

Now that I’ve heard about it, seems that the teddy bear sitting in the hallway will get some attention now ;) .

]]>
By: Mitch Wheat http://compsci.ca/blog/delete-bugs-and-broken-code/comment-page-1/#comment-82236 Mitch Wheat Sat, 10 Nov 2007 00:38:11 +0000 http://compsci.ca/blog/delete-bugs-and-broken-code/#comment-82236 McKenzie, that is what Source Code Control is for! I agree with your comment about Clutter. As Steve McConnell said in "Code Complete": If the comment and code disagree, then they are both probbaly wrong! McKenzie, that is what Source Code Control is for!

I agree with your comment about Clutter. As Steve McConnell said in “Code Complete”: If the comment and code disagree, then they are both probbaly wrong!

]]>
By: McKenzie http://compsci.ca/blog/delete-bugs-and-broken-code/comment-page-1/#comment-81889 McKenzie Fri, 09 Nov 2007 00:49:40 +0000 http://compsci.ca/blog/delete-bugs-and-broken-code/#comment-81889 One minor point that makes the deleting less painful. Save your program as a new version and delete the buggy code in the new version. Although you will almost never go back to the old version it is comforting to know that you can. Commenting out the buggy mess is OK too, but I find the clutter can distract you. One minor point that makes the deleting less painful. Save your program as a new version and delete the buggy code in the new version. Although you will almost never go back to the old version it is comforting to know that you can. Commenting out the buggy mess is OK too, but I find the clutter can distract you.

]]>
By: dontmiss http://compsci.ca/blog/delete-bugs-and-broken-code/comment-page-1/#comment-81815 dontmiss Thu, 08 Nov 2007 20:48:15 +0000 http://compsci.ca/blog/delete-bugs-and-broken-code/#comment-81815 Of course this only apply to your own code or for a code where you have a really good knowledge of the entire code involved. Or sometime, you have some function that doesn't interfere to much with the other code (get some params, return some others). I had this recently too, I was falling asleep on some complex function made from various version I did before, I rewrote all from scratch the next morning in a much more efficient way. Of course this only apply to your own code or for a code where you have a really good knowledge of the entire code involved.

Or sometime, you have some function that doesn’t interfere to much with the other code (get some params, return some others).

I had this recently too, I was falling asleep on some complex function made from various version I did before, I rewrote all from scratch the next morning in a much more efficient way.

]]>
By: engtech http://compsci.ca/blog/delete-bugs-and-broken-code/comment-page-1/#comment-81295 engtech Wed, 07 Nov 2007 18:45:13 +0000 http://compsci.ca/blog/delete-bugs-and-broken-code/#comment-81295 rewrites only work if it's your second time solving the problem rewriting someone else's broken code means your also leaving out what might potentially be code to handle a dozen corner cases you haven't thought of because it's your first time solving the problem. rewrites only work if it’s your second time solving the problem

rewriting someone else’s broken code means your also leaving out what might potentially be code to handle a dozen corner cases you haven’t thought of because it’s your first time solving the problem.

]]>
By: Adam Mckerlie http://compsci.ca/blog/delete-bugs-and-broken-code/comment-page-1/#comment-81245 Adam Mckerlie Wed, 07 Nov 2007 14:38:52 +0000 http://compsci.ca/blog/delete-bugs-and-broken-code/#comment-81245 Here's an example of when it's better just to delete code than to try and debug it: I was writing an algorithm for finding the shortest path through a bunch of airport stops. It was two days before it was due and it was around 3am. I basically just spit out a tonne of code, and then fell asleep. The next morning I came back to my code and tried to get it to work. After two hours and looking through the horribly coded algorithm I decided to delete it and try again. It took me one hour to write the new algorithm. It worked, was more efficient and was about half of the code. It probably would have taken me another at least 5 hours to re-write the previously poorly coded algorithm instead of the one hour it took me to write a new one. The moral of this story is 1) Delete your code if it's more efficient just to re-write it and 2) Don't code at 3am Here’s an example of when it’s better just to delete code than to try and debug it:

I was writing an algorithm for finding the shortest path through a bunch of airport stops. It was two days before it was due and it was around 3am. I basically just spit out a tonne of code, and then fell asleep.

The next morning I came back to my code and tried to get it to work. After two hours and looking through the horribly coded algorithm I decided to delete it and try again. It took me one hour to write the new algorithm. It worked, was more efficient and was about half of the code.

It probably would have taken me another at least 5 hours to re-write the previously poorly coded algorithm instead of the one hour it took me to write a new one.

The moral of this story is 1) Delete your code if it’s more efficient just to re-write it and 2) Don’t code at 3am

]]>
By: Darcy http://compsci.ca/blog/delete-bugs-and-broken-code/comment-page-1/#comment-81232 Darcy Wed, 07 Nov 2007 13:14:47 +0000 http://compsci.ca/blog/delete-bugs-and-broken-code/#comment-81232 Just make sure you've got a complete set of unit tests for the code you're deleting. Otherwise, if you're scrapping real, production code, you're likely deleting years of bug fixing along with the one bug you need to deal with. Just make sure you’ve got a complete set of unit tests for the code you’re deleting. Otherwise, if you’re scrapping real, production code, you’re likely deleting years of bug fixing along with the one bug you need to deal with.

]]>