On 1/8/07, Stephen Colebourne <[EMAIL PROTECTED]> wrote:
Martin Cooper wrote: > Could you say more about this, please? I happen to disagree on > exceptions as > inner classes being a bad idea; FileUpload has done this for years, without > any problems. But I'm always interested in hearing new perspectives... I guess its stylistic, and therefore subjective. But I see an exception as a critical system object, and not one that should be relegated to inner class status.
Inner classes are not inferior in any way, so there's no "relegation" going on. An inner class makes perfect sense for a class that has little relevance in isolation from another class, which is exactly the situation when you have a exception that is tied to its enclosing class. If the exception is specific to that class, what better way to document that than by making the exception an inner class? I pretty much only use inner classes for the internals of the main
class. Details that shouldn't be exposed as part of the public API, except for very specialist users. Catching a cancellation exception doesn't seem to be a special case.
As I mentioned above, there is nothing inferior about inner classes. If you choose to view them that way, well, that's a separate issue altogether. ;-) -- Martin Cooper For example, I also dislike Map.Entry, and think it should be MapEntry.
(Well, actually I think map entries are the biggest mistake in the collections framework but thats another story...) Stephen --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
