Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 64703 invoked from network); 13 Jun 2002 22:28:03 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 13 Jun 2002 22:28:03 -0000 Received: (qmail 9315 invoked by uid 97); 13 Jun 2002 22:28:09 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 9271 invoked by uid 97); 13 Jun 2002 22:28:08 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 9253 invoked by uid 98); 13 Jun 2002 22:28:07 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Message-ID: <20020613222803.87340.qmail@web21208.mail.yahoo.com> Date: Thu, 13 Jun 2002 15:28:03 -0700 (PDT) From: Jonathan Carlson Reply-To: joncrlsn@users.sf.net Subject: Re: [Collections] Naming conventions To: Jakarta Commons Developers List In-Reply-To: <00d701c2131a$c12e2720$d44d18d4@oemcomputer> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Concerning the Collections name collisions. Here's another option: I personally like the Lists, Sets, Collections, etc naming, too. We could put pass-through methods to java.util.Collections on the commons.Collections class. That way we can have our cake and eat it too. The only people that would have to use the whole path name would be those who import java.util.*. And I, personally, think that is a sloppy convention anyways because it makes it very difficult on new Java developers trying to learn a system, in addition to Sun's suggestions against it. This next idea would be a last resort, but we could come up with an automatic java.util import generator for those java.util classes used in the class. It would be relatively easy to do with regular expressions and the BeanShell. Jonathan --- Stephen Colebourne wrote: > Following this through we have > Collections > Lists > Sets > Maps > Bags > Trees (hopefully!) > Predicates > Transforms > Factories > Comparators > Iterators > > I see three issues: > 1) 'Collections' still clashes with java.util. We could: > - say tough, use the full package name > - name it ApacheCollections > - name it CommonsCollections > - use the name CollectionUtils for just that one > - use the name XxxUtils for all the above > > 2) Subclassing would be more complex. Currently each > Predicate decorator > implementation extends another based on the interface > hierarchy. In order to > continue this, the static nested classes would need to be > package scoped, > not private. Not a big issue, but it should be noted. > > 3) Defining the relationship between ListUtils and Lists, > CollectionUtils > and Collections and MapUtils and Maps. Unfortunately, > ListUtils, > CollectionUtils and MapUtils are @since 1.0, so we are > not free to rename > them. > > > After a little thought, I think I favour adding Utils to > all of the above. > Results in no clashes with Java, and just involves adding > methods to > ListUtils, CollectionUtils and MapUtils. > > On method names, I agree with your implicit use of > yyyedXxx, eg. > filteredMap or predicatedSet > > Stephen > > BTW: I thought of two more decorator groups - Transform > (already discussed a > little while back) and FixedSize (doesn't allow the size > to change). And I > like the Comparator to Predicate idea. > > ----- Original Message ----- > From: Jack, Paul > > Here's an idea. We can make the source more manageable > > and effectively limit the number of public classes by > > breaking my One Decorator Class To Rule Them All into > > smaller ones based on subinterface: > > > > Bags (for SortedBags too) > > predicatedBag > > predicatedSortedBag > > synchronizedBag > > synchronizedSortedBag > > unmodifiableBag > > unmodifiableSortedBag > > eventBag > > eventSortedBag > > filterBag > > filterSortedBag > > Lists > > predicatedList > > eventList > > filterList > > Maps (for SortedMaps and MultiMaps too) > > Sets > > > > It avoids the naming collision, keeps the source in > > distinct places, and prevents us from having another > > public class every time somebody comes up with > > another great decorator idea... > > > > Though I guess we would need another public class > > every time somebody comes up with another great > > Collection subinterface. But that doesn't seem like > > it would happen as often as new decorators (we already > > have 5 new decorator ideas on the table, no > > outstanding Collection subinterfaces...) > > > > Also, the more I think about it, it seems that > organizing > > the source code according to return type makes a lot of > > sense, as a rule of thumb. For instance, where do we > put > > this method? > > > > // Returns a predicate that returns true for objects > > // that are greater than o, according to the sort > > // order specified by c. > > public Predicate greaterThan(Object o, Comparator c); > > > > It uses a comparator, but produces a predicate. Does > it > > go in Comparators or Predicates? With the > > organize-by-return-type approach, it's obvious that we > > put it in PredicateUtils; and it's hopefully obvious to > > a user of the library where to find such a beast. > > > > -Paul > > > > > -----Original Message----- > > > From: Stephen Colebourne > [mailto:scolebourne@eurobell.co.uk] > > > Sent: Wednesday, June 12, 2002 2:18 PM > > > To: Jakarta Commons Developers List > > > Subject: Re: [Collections] Naming conventions [was > > > ComparableComparator > > > - nulls OK] > > > > > > > > > Good argument, and logical. However the 'Collections' > class > > > could have 6 or > > > more groups of decorators if the dreams become > reality. Maybe > > > this isn't a > > > problem, but I wouldn't want that class to contain > all the > > > static nested > > > classes (for maintainability) > > > > > > There is another factor - the classes don't just > contain decorators. > > > FactoryUtils/PredicateUtils (current names) create > > > Factory/Predicate objects > > > not decorate them. > > > > > > Some possibilities: > > > - CollectionUtils > > > ie. add to existing class, probably should merge in > ListUtils > > > too - this > > > seems quite a big change. And MapUtils doesn't fit > well (its rather a > > > strange group of methods) > > > > > > - Decorators > > > - CollectionDecorators > > > - DecoratedCollections > > > - DecoratorUtils > > > these emphasise the role of the resultant classes, > but how is > > > the source > > > laid out > > > > > > - SynchronizedCollections, PredicatedCollections, ... > as I originally > > > proposed > > > these emphasise the particular decorator, and fit > well with > > > managable source > > > units > > > > > > > > > Deciding where the source will go is another factor > in this. > > > Nice can of > > > worms! > > > > > > Stephen > > > > -- > > To unsubscribe, e-mail: > > > For additional commands, e-mail: > > > > > > > > -- > To unsubscribe, e-mail: > > For additional commands, e-mail: > > ===== Jonathan Carlson joncrlsn@users.sf.net Minneapolis, Minnesota __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: For additional commands, e-mail: