Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re (tilly) : (Ovid - devel vs. production) Re(2) Auto prepare code for production

by tilly (Archbishop)
on Jan 26, 2001 at 01:21 UTC ( #54365=note: print w/replies, xml ) Need Help??

in reply to (Ovid - devel vs. production) Re(2) Auto prepare code for production
in thread Auto prepare code for production

I think you entirely missed my point. I was suggesting that you produce a small module or two that either differs between development and production, or automatically detects that, then behaves appropriately. So you would do:
use My::Configurable::Debugging; my $debug = My::Configurable::Debugging->new();
and then later do:
$debug->print_table{ ORDEROBJECT => $order );
which calls a method that might or might not actually do anything useful.

Now through the bulk of your scripts there is no change betweeen production and development. You don't litter your code with tags where if a developer forgets the tags somewhere they could let debug code slip into production. Or where they can put the tag in and forget that the line does something non-trivial and important. Relying on people to not make mistakes when there is no way they can get feedback that it is a mistake is a Bad Idea. Better yet since the shipped code has all of the debugging support present (though not active), you can easily turn that into a logging option in production if something works as not expected...

What is key is to arrange to be sure that your development environment will (except for minimal necessary details) appear identical to production. Making this process take little to no care on the part of developers removes a significant cause of error. In fact this is the old mantra of centralizing your logic in one place rather than scattering it through your code, whether it is scattered through if conditions, preprocessor statements, etc.

If you write a complicated standard and say, OK. If we all manage to follow this carefully, never making mistakes, everything will work fine! you are guaranteeing that it won't actually happen. If you write a simple standard and say, Here is the API. As long as we only use this API the process should not mess up! you at least have a fighting chance...

Replies are listed 'Best First'.
Re: Re (tilly) : (Ovid - devel vs. production) Re(2) Auto prepare code for production
by toadi (Chaplain) on Jun 26, 2001 at 18:30 UTC
    And then to think here at work they even hardcode the stuff, copy it to production and then change the environment specific stuff :)

    Tried to explain it's better your way, but they say this is faster...

    My opinions may have changed,<BR but not the fact that I am right

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2016-10-25 05:00 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (315 votes). Check out past polls.