Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Code Maintainability

by webfiend (Vicar)
on Dec 04, 2008 at 14:29 UTC ( #727988=note: print w/ replies, xml ) Need Help??


in reply to Code Maintainability

I definitely agree that you should take advantage of Perl's rich syntax, even though I lean towards a verbose code style myself. The main issue I had with your meditation was about constructor arguments, and that was already addressed by Moritz.

I'd still like to comment on the bit about debugging. I tend to shuffle any logic for debugging into a sub, and invoke that sub whenever I need something dumped:

# Skipping boilerplate pragmas ... use constant DEBUG => 1; sub debug { if (DEBUG) { say STDERR (ref $_[0]) ? Dumper $_[0] : $_[0]; } } debug("Something is on fire"); debug([ qw(fire famine flood) ]);

This way I can easily change what I mean when I say debug - print to STDERR, log to a file, dump to a database, summon the remote controlled sky writing airplane, whatever. It's really just another opportunity to avoid copy and paste coding.


Comment on Re: Code Maintainability
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2015-07-07 09:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls