The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2002

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

My opinion

Posted by Jay on January 18, 2002 at 8:15 PM

Since you asked, heres what I think:

Frankly, I wouldnt go with either of those versions. Validating two entities within the same method, in my opinion is not the best of ways unless you have a reason. Also the method name doesnt give me a hint what its doing.

I would go with some thing along these lines:

public boolean isThisGreaterThan10(int cycle)
{
if(cycle < 10) return false;
return true;
}

And a different method that checks size. If you prefer an exception, in case log of some kind is required,

public boolean isThisMyKindaDate(Date date) throws EndOfTimeException
{
if(date.getTime() < 0) throws new EndOfTimeException("Lets Start Over!");
// check date.
return ...;
}

Any ideas?

Jay




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us