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

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

If you're lucky enough to be working on part of a larger project or organization with defined coding standards, stick to those even if they disagree with your personal taste. People tend to get annoyed when they see you've checked in a two-line substantive change and 50 lines of renaming variables, moving braces, etc.

As an example, many people on my team never learned the lesson about bind variables in DB calls. So if I'm working with code that has this problem, I'll fix the statements involved in the code I'm working on but I'll leave the other ones in the module alone, unless I spot an actual bug in them.

Refactoring, especially within a module, is usually a good idea if it helps you introduce the change you need to make more cleanly. If I find that there's existing code that has two largely identical blocks and my change would require editing both of them, I'll try to combine them first so my new change becomes smaller. But I don't generally refactor code unrelated to the change I'm making even when I'm certain I'll do it better, just because it's not relevant at that moment.

If the change you need to make is more fundamental, or if the existing code is so horribly fragile that it can't accept any further changes, then large-scale rework (if not rewriting) may be called for. But be careful with this. When you see what looks like incomprehensible weirdness in the existing code, remember that it may reflect incompetence or laziness on your predecessor's part, but it may also have been a necessary workaround for some unpleasant real-world scenario.

In reply to Re: Maintenance vs. Programming style by Errto
in thread Maintenance vs. Programming style by apl

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 or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2022-05-28 01:19 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (98 votes). Check out past polls.