On Wed, 2002-10-09 at 11:00, Aaron Held wrote:
> >>BTW, I've been using an alternate Page-like servlet structure (which I
> >>haven't put in CVS or anything -- but maybe I should put it in
> >>Experimental).  Anyway, it makes much more significant use of
> >>exceptions.  I have a feeling it would simplify what you are doing,
> >>since at any point you could raise a Forbidden exception.  In general
> >>I've found that cleaner than doing security through if statements.
> 
> Putting on the software architect hat:
> Exceptions make life easier, but I personally feel that an 'exception' 
> is a program error.  A user trying to access a forbidden page should be 
> trapped by normal code.  Exceptions should be reserved for unexpected 
> situations.

Well, if we're taking a lesson from Python, exceptions are simply
exceptional behavior (which can be quite mundane).  After all, every
generator finishes its sequence with an exception.  Things like failed
permission seems very much like exceptions to me intuitively, and I
think it works well in the code as well, which is always the final test.

> Putting on the developer hat:
> It sounds like a much cleaner way to go.
> 
> Puttin on the Java hat:
> In java catching an exception is MUCH slower then running an if test. I 
> never tested python though.

I believe Python exceptions are quite fast.  Or maybe the if statements
are quite slow :)

> Overusing exceptions could get ugly long-term and wind up as 
> unmaintainable as PHP.

I don't know how to describe the difference between a hack and a good
control structure, but I know them when I see them ;)  (and PHP is all
hack -- not that Python can't have hackish control structures
*coughzopecough*)

  Ian




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to