API Design

posted @ Sunday, July 31, 2005 7:40 PM

 

Just wanted to note something that caught my eye the other day. According to Improving .NET Application Performance and Scalability, part of the Patterns and Practices series, exceptions should not be used to control regular application flow. I noticed that the comments as part of the PrincipalPermission.Demand method, the method itself returns void, however the mechanism you use to determine success or failure is whether or not it threw a SecurityException. Hmmm, why not just return a bool instead? I wonder if this will change in the future? Does this bother anyone else?