commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject Re: [lang] Proposal (2): isEmpty
Date Sat, 19 Jul 2003 17:58:15 GMT
----- Original Message -----
From: "Todd Jonker" <tvj@pobox.com>
> If we are changing the semantics of isEmpty  AT ALL, then any client code
> will need to be altered in order for its operation to remain unchanged.
> Which means the safest thing for all users to do, to guarantee that their
> programs' behaviors are not changed, is to simply search-and-replace
> "StringUtils.isEmpty(" with "StringUtils.isBlank("

> In other words, is we are correcting isEmpty to not trim, we're not saving
> anyone any work by keeping to true on null.

Not necessarily. There is an indication that users are currently working
under the assumption that isEmpty() does not trim. This appears to be the
case for Tapestry and Turbine. Therefore, those users actually want the
proposed change.

-----
> Which to me implies that we might as well give isEmpty the correct
semantics
> relative to the standard, Sun-defined meaning of "empty".

You could argue the proposal is fixing isEmpty to Sun semantics. We're just
being null-friendly like the rest of StringUtils as well.

Also when I first came across [lang] I didn't expect isEmpty() to trim, but
I did expect null to be true (thats how my own utility codes it).

-----
> I still "vote" for Stephen's earlier proposal.  I don't mind the long
names
> because they are accurate and non-misleading, unlike the current names
(and
> some of those below).

Long names are accurate and  non-misleading I agree.  But they are user
unfriendly in typing terms and practical usage. The more I've thought about
this the more I want the short names and null true.

Stephen

>
> On 7/18/03 6:33 PM, scolebourne@btopenworld.com wrote:
>
> > Proposal for methods:
> >
> > - isEmpty() - true for "" or null
> > - isNotEmpty() - opposite
> > - isEmptyNN() - true for ""
> >
> > - isBlank() - trims - true for "  ", "" or null
> > - isNotBlank() - opposite
> > - isBlankNN() - trims - true for "  " or ""
> >
> > - isWhitespace() - true for all whitespace, "" or null
> > - isNotWhitespace() - opposite
> > - isWhitespaceNN() - true for all whitespace or ""
> >
> > Where NN means NotNull.
> > This covers all the cases, and takes the working premise that more
people
> > want null to be true than false.
> >
> >
> > Proposal for location:
> > 1) In StringUtils. Incompatable change to isEmpty() (no longer trims)
and
> > isWhitespace() (null now true).
> >
> > 2) In StringTests (new class). Deprecate StringUtils isEmpty/isNotEmpty.
> >
> >
> > I prefer the incompatable change #1. We are offering a simply named
> > alternative. Also, some people already don't expect isEmpty to trim. And
> > Tapestry and Turbine should both be OK.
> >
> > Stephen
> >
> > PS. If no agreement is forthcoming, then we shall have to revert to the
1.0
> > methods in order to get a release.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> >
> >
>
> --
>
> A patriot must always be ready to defend his country against its
> government.  -Edward Abbey, naturalist and author (1927-1989)
>
>     Defend our country!  Vote Howard Dean 2004
>         http://www.DeanForAmerica.com/
>         http://www.MoveOn.org/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message