I have no problem with it. I often throw things like IllegalArgumentExceptions (when a bad parm is passed in), IOExceptions (if a network object couldn't be initialized), etc. from constructors.
What's the alternative? Have the constructor complete successfully and pass around an object that's in an invalid state? IMO a constructor is just another method, and construction may fail just like any other method, so throw an exception from a constructor if that's the appropriate thing to do. DR On Thursday 03 October 2002 11:14 am, you wrote: > A developer on our team just introduced a new set of classes the project > that throw an exception from the constructor. > The classes follow the Value Object pattern so they're just data > containers. The exception is thrown if a null value is passed in. > > This seems like a really bad idea to me with no inherent benefit but the > developer is holding fast to his implementation. > Are there any philosophies out there on this subject? > > Thanks! ____________________________________________________ To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm Be respectful! Clean up your posts before replying ____________________________________________________
