We don't bite newbies here... much | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
"How can I re-use this?" is something that I'm trying to make a mantra, especially after reading through The Pragmatic Programmer a couple of times. Modular, orthogonal code is a Good Thing. Not really a mantra, but one concept that's stuck with me pretty much forever is the idea of conservation of difficulty, which was introduced to me by one of my profs in an intro programming course. The idea is that every problem has a set difficulty, and making some part of the solution easy (writing hacked-up, off-the-cuff code, for instance) will make another part difficult (debugging). Sometimes, the tradeoffs between easy and difficult are political at best (doing the hard bit when nobody's looking, and saving the easy finishing touches for when your boss shows up), but (here's the tie-in with reusable, orthogonal code) often you can do the difficult bits of many problems once -- by writing a module to do something clever that relates to a bunch of your problems, or spending an hour or two putting together a really elegant interface to a function you'll call a lot, for instance. "How am I going to debug this?", and it's friend "How am I going to test this?", are ones that I should keep in mind, though. --:wq In reply to Re: Programming Mantras
by FoxtrotUniform
|
|