Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Questions from "Coders at Work"

by bsb (Priest)
on Oct 18, 2009 at 09:46 UTC ( [id://801850]=note: print w/replies, xml ) Need Help??


in reply to Re: Questions from "Coders at Work"
in thread Questions from "Coders at Work"

I like the idea of learning code by rewriting it. It would be hard work, but probably quite effective.

Your outlining approach to the development sounds similar to mine, although I tend to scribble on paper for a while first.

Replies are listed 'Best First'.
Re^3: Questions from "Coders at Work"
by roboticus (Chancellor) on Oct 19, 2009 at 15:25 UTC
    bsb:

    It's really not so bad, since you don't start from a blank slate. I just compile it to make sure it all works and that my development environment is ready. I play with the program a little to see how it reacts. While playing, I make a few test cases so I can compare my "improvements" against the production system.

    Then I start reviewing the code. I don't bother to rewrite the obvious stuff, only the stuff that I need to figure out. Then I rewrite that chunk of code and fine tune it, making sure to test the code.

    Finally, I should mention that when I rewrite, I don't just blow away the chunk of code and write blindly. Some chunks of code are fine, so I can use them as is (though I might move them to a more "sensible" location). So you can do the rewriting fairly quickly, unless you start finding odd mismatches in your test cases. Then it can be a be a bit slow going.

    A case in point is from Uploading pictures - displays only 2 of 12: The code was repetitious, so rather than making myself go blind looking for a subtle difference or missed edit between each repeated block, I added a little code to set up some values and then ran the code to generate my reference output. Then I assumed that all the blocks were the same and turned it into a loop. I then ran the code and compared the output to the original, and there was no difference. The original complaint was that the code acted differently depending on how many items were selected. I didn't see any evidence of problems in my updated code, and he didn't provide a complete example, so I expect the problem was elsewhere, and I left it at that.

    ...roboticus
      One of the later interviewees (Bernie Cosell) described a similar rewrite-to-understand approach.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://801850]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-16 10:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found