Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Wow,</p> <p>First off, can you please distill the question down a bit, while it was nice to read a well thought out and explained question, that was quite a lot to digest.</p> <p>The short answer is "yes", but it can depend.</p> <ul> <li>We have some applications where we have lots of business logic tied up in the SQL queries (not my design Gov!). If this is how it is structured, management can be difficult to convince of otherwise since it "already works".</li> <li>In this situation, does it really make a big deal? Since it's still one trip across the wire and back. Does the server do much before it realises that it cannot continue (i.e.if there is a sequence of transactions that take place to your action, does it then fall over half way through, wasting time?).</li> <li>Does it make sense to do the check in the UI first? Does it help with your application? If it provides a nicer user experience? (i.e. I have seen cases where you step through several steps in a wizard, it starts, then falls over, when it had all the info it needed to fall over after step 1).</li> <li>Is concurrency an issue? Is it possible that the record may be removed/edited or whatever before your commit takes place (as in the classic <code>File.Exists</code> boo-boo).</li> </ul> <p>In my opinion:</p> <p><strong>I would do <em>both</em>. If I can fail fast and provide a better user experience, great. Any expected SQL (or any other) exceptions should be getting caught and fed back appropriately anyway.</strong></p> <p>I know there is a concensus that exceptions should not be used for other than <em>exceptional circumstances</em>, but remember, we are crossing application boundaries here, <strong>expect nothing</strong>. Like I said, this is like the <code>File.Exists</code>, there is no point, it can be deleted before you access it anyway.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload