Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: (4) Ternary confusion

by dragonchild (Archbishop)
on Feb 28, 2004 at 04:24 UTC ( [id://332450]=note: print w/replies, xml ) Need Help??


in reply to Re: (3) Ternary confusion
in thread Ternary confusion

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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-03-28 12:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found