commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <>
Subject [lang] Validate, method names, class name
Date Fri, 22 Apr 2011 16:13:05 GMT
Hi All:

I find that the new 'valid' method names in Validate make for odd reading.

I think a verb like 'validate*' or 'check*' would be better. Especially when
the Javadocs all start with 'Validates...'.

I do see 'check' used in other internal APIs for this kind of behavior. For
example, Java Swing and Eclipse SWT use 'check*' methods to validate state
and throw exceptions.

For example:

    public void doSomething(String str) {
        Validate.validateIndex(str, 1);


    public void doSomething(String str) {
        Validate.checkIndex(str, 1);

The Validate class name is odd too because it is a verb. I would expect

    public void doSomething(String str) {
        Validator.validateIndex(str, 1);

A validator validates (or checks) values.

I think I like best the 'check*' methods, probably because I've seen them in
SWT and Swing for so long.


Thank you,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message