Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My feeling is that you are over using exceptions. As referenced by the name, an expection should only be thrown under <strong>Exceptional Circumstances</strong>.</p> <p>Exceptions should not be used to control the flow of your application. Users entering bad data or not entering a correct username and password would be considered part of the normal flow of your application, not something exceptional.</p> <p>You should only throw exceptions in exceptional circumstances that could potentially render the whole or part of the application unusable, for example, not being able to connect to the database.</p> <p>This way, you will not end up with so many exceptions in the system that requires catching and perhaps rethrowing.</p> <p>It is a good idea to have different exceptions, for example, I use the <a href="http://www.redbeanphp.com/">RedBean ORM</a> to talk with my database, and it uses these Exceptions:</p> <ul> <li>RedBean_Exception_Security (when a security exception has occurred).</li> <li>RedBean_Exception_SQL (when bad sql syntax or some other issue has occurred).</li> </ul> <p>Being too specific about the exception can lead to a lot of confusion. For example, if I have an exception for <code>missing sql column</code>, <code>bad syntax</code>, <code>missing value</code>, etc, it can become quite unmanagable. But if I have an <code>SQL_Exception</code>, and use that exception for all of the above, then it is much more neater and simplier to manage.</p> <p>As for performance, having to load a lot of classes (I am assuming they are in external files), can be taxing to the application. This can be partially aleviated by using <a href="http://php.net/manual/en/book.apc.php">APC</a>, to cache interpreted PHP code in memory. But this is hard to tell without any profiling.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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