Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Maybe it's because
  • I've had to write the same DBI connection code over and over
  • I've had to have a $dbh available in a bazillion different places
  • I've needed config files for other reasons
  • I'm just really paranoid about usernames/passwords in code
but I find that making decisions in code about which database to connect to based on an environment variable is obfuscated by its very nature. The ternary operator is not obfu. I personally don't use it a lot (kinda like I don't use select alot), because I abstract decisions away to the entity that needs to make the decision. (I'm a refactoring-nazi, actually.)

I'm going to take issue with your last paragraph. Any developer worth their salt should have a number of modules in use that allow for reuse. For example, I have a set of tools that would allow me to do almost any one-off task without writing much code for database connections, configuration, and the like. And, it's almost quicker to write it factored out than it is to write it as one big blob. Why? Because it's easier to verify that your code which may only have one chance to be executed will do it right. Because you're never noticed when you succeed, but you're in the spotlight if you fail. Developers will always have time to develop correctly, if they plan as if they will need to do so in the next hour.

------
We are the carpenters and bricklayers of the Information Age.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.


In reply to Re: (4) Ternary confusion by dragonchild
in thread Ternary confusion by Nik

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 sharing their wisdom with the Monastery: (4)
As of 2024-03-28 17:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found