[Beowulf] Re: "hobbyists"
Robert G. Brown
rgb at phy.duke.edu
Fri Jun 20 11:18:04 PDT 2008
On Fri, 20 Jun 2008, Tim Cutts wrote:
>
> On 20 Jun 2008, at 4:12 pm, Mike Davis wrote:
>
>> Reading code is IMHO one of the most important parts of learning to write
>> good code. It doesn't matter if the target language is f77, C, or even
>> (gulp) java. Reading well written code will help one to understand how to
>> construct it.
>
> That's true. I thought I wrote reasonably well structured and maintainable C
> until I saw some code written by an ex-colleague of mine, and realised just
> how good some people are!
>
> It was far better than the majority of code I've seen, and that includes
> almost all the open source stuff I've had to grub around in.
Also, use version control and NEVER throw ANYTHING you write away. My
view of "object oriented design" and "code reuse" is to gradually build
a large code base of code you wrote, however good, that solves various
"frequently encountered problems" in one segment or another of the
program. If you have a decent memory, eventually this becomes a
fragment code bank. I'm constantly saying to myself "gee, I wrote a
program a few years ago where I had to parse down a decision tree just
like this one -- let me go grab what I did then and at least use it as a
starting place." Sometimes I learn that my earlier code had bugs or
sucked and I rewrite from scratch anyway. More often (by now) I just
grab the code, change the variables and rearrange a bit (or import a
subroutine set for e.g. managing linked lists the way I prefer them or
the like) and I'm done.
And I would often KILL for a good, simple piece of code to accomplish
certain tasks even today. When I was getting started with writing
daemons and raw networking, some pieces of example code saved my life.
I've looked repeatedly for a userspace "ping" fragment that I could use
to check for a host being up in a lightweight way and without suid root
(feel free to direct me -- nmap has a "sort of" solution, but I'm still
looking:-). Examples of code that use various library calls are often
worth a week of staring at often indifferent documentation.
rgb
--
Robert G. Brown Phone(cell): 1-919-280-8443
Duke University Physics Dept, Box 90305
Durham, N.C. 27708-0305
Web: http://www.phy.duke.edu/~rgb
Book of Lilith Website: http://www.phy.duke.edu/~rgb/Lilith/Lilith.php
Lulu Bookstore: http://stores.lulu.com/store.php?fAcctID=877977
More information about the Beowulf
mailing list