Hacker News new | ask | show | jobs
by golergka 1902 days ago
> Retyping out programs from magazines isn't even something most programmers have considered these days

I'm still retyping stuff from stack overflow instead of copying. I find it really effective to really think through the code you're borrowing from somewhere — because once it's committed under your name, you're the one responsible for it.

2 comments

The last thing I think I got from SO was an implementation of the Boyer-Moore Algorithm for a byte searcher. I think retyping it would have probably introduced bugs: and as it worked on a test case I had to hand and could verify (finding the data header size in a WAV file by looking for `data` followed by the SubChunk2Size bits, which I could verify with `afinfo`) I was happy to use it rather than learn how the algorithm worked.

As Morpheus said, “Time is always against us”.. so I just made sure it followed our coding standards, checked the test cases, and moved on.

But, I am old enough to remember code listings in magazines. I like to think the typesetters introduced deliberate mistakes because they hated the work so much - not to disrespect the fine profession of typesetters, but when you set your 100th `Poke` command in a row, you might think this isn’t what you signed up for..

> I'm still retyping stuff from stack overflow instead of copying. I find it really effective to really think through the code you're borrowing from somewhere

Numerical Recipes in C. Had the hard copy but not the disk.

Often the code was just to obscure to work out as you typed, but there was some real value to typing it in. You got some real feel for it. Additionally it offered hard lessons in writing test cases.