|Do you know where your variables are?|
Monk ethics: Beauty vs. Powerby kaatunut (Scribe)
|on Dec 18, 2000 at 21:28 UTC||Need Help??|
Even though I am merely an Adept or so, already the beauty of code is something to strive for, to me. When moved from BASIC (shudder) to C, I was stunned by the seemingly magical expression wizardry of C (hey, after BASIC...). To think that you could do entire loop's job inside while() ! It eased up a bit, the joy of game diminishing, and soon I was again wading in the bore of function/class structures.
But THEN, then I learned perl. At first I wrote it almost like C (look at E2 node tracker to see what I mean...), but as time passed I started to slowly learn a bit stranger magic. Now, as I just wrote some rather peculiar (well, to me) expression, something struck me:
Is a monk's ethos (?) to create working code, or to create beautiful code (when they do not coincide)? Is the purpose of perl to create code quick, or to give the pleasure of expression meditation to the coder?
I realize that often beautiful code IS better code, efficient- or reusability-wise. But is it always? What to do if, no matter how bad it looks, a code is tad more efficient? And isn't it a bit, um, counter-productive to spend your time thinning out a block of code when you could be creating new?
P.S. My idea of 'beautiful' is influenced by my recent learning of perl and might not match yours. Still, I can't help but to observe that typical perl code *does* make use of strange chains in one expression as opposed to C-style procedures.