In certain systems - terrible, heartbreakingly-awful systems - I use try.. catch instead of ifs, against those system's best practices.
If your ifs need a dozen conditions to get a single value out of an object, and you can do the same by handling an exception... go with the exception.
if
It's more readable, for one thing.
I know it makes it harder to track down what went wrong when something goes wrong. I know it pongs a bit.
But life's too short for entity metadata wrappers.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In certain systems - terrible, heartbreakingly-awful systems - I use try.. catch instead of ifs, against those system's best practices.
If your
if
s need a dozen conditions to get a single value out of an object, and you can do the same by handling an exception... go with the exception.It's more readable, for one thing.
I know it makes it harder to track down what went wrong when something goes wrong. I know it pongs a bit.
But life's too short for entity metadata wrappers.