Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Wow! Excellent suggestions and some interesting strategies that I hadn't ever thought of.

One thing I would suggest is that info and debug level logging can replace comments. Just like code, there is no sense duplicating non-code either.

That is something that had never occured to me. I really like that. It will take some getting used to, however. I tend do copious commenting and have found that, to some extent, the commenting (as with the logging) can easily get in the way of viewing the actual code logic and flows. The idea of using logging as an alternative to commenting sounds really powerful and offers the opportunity to "kill two birds with one stone" as they say.

As for the warn and error levels, testing for those cases could mostly be done at the beginning of a function, while you're gathering and validating parameters.

Again, a great suggestion. I will work on that.

Rather than putting a log message in the center of a function where it makes a call, try to move the logging into the function being called. The function was probably written to keep things clear and avoid duplication of code, so you might as well use it to avoid duplication of logging commands too.

So true and an excellent observation and strategy.

The trick would be learning to read debug-info logging as if it were a comment. Perhaps by adding a rule to the code highlighting in your editor.

I agree; it is something I'll have to work on.

One thing that your suggestions leave me curious about is sort of highlighted by that last comment (re: "...learning to read debug-info as if it were a comment..."). Does that bode poorly for maintainability of code by others? That is, does that tend to make the code less accessible to others who may not have developed the facility of reading debug-info as comments?

Just curious. Thanks so much for the great ideas and suggestions. I really appreciate it.

ack Albuquerque, NM

In reply to Re^2: Balancing Logging and Code Readability by ack
in thread Balancing Logging and Code Readability by ack

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 chanting in the Monastery: (2)
As of 2024-04-26 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found