Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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...


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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 15:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found