+1 to good discussion here. Good read for me. I think I agree with how developers should really know what they are doing. I bet we all have experienced times where we wish people using our functions use them properly.
However, I think Ben still has a point in being DEFENSIVE. I agree with Ben that finger-pointing wouldn't help Alice, Bob, nor Carol but defensive programming of some sort by Alice might. We can always blame Carol for not reading the API docs close enough as she should, but this is like blaming any one that ran the red light and caused a traffic accident that could still be avoided if the party that has the right-of-way chose to slowdown when crossing the intersection. Maybe people here just don't agree with the METHOD proposed by Ben about changing to LinkedHashMap though I don't know how to better defend Alice's API. I learnt in my Win32/C++ experience that very defensive people creates debug-only mines that blow up in the face of the developer not following designs (in this case Carol). Although random and maybe irrelevant, I think the following example illustrates how can Alice be defensive when she wants to emphasize that the returned HashMap is NOT "iteration-order-defined". Carol will get a huge fail from compiler/debugger/anything before the code goes public if she assumed iteration-order for the HashMap Alice provided. I would suggest something as useful/clever along this line except unfortunately I'm not experienced enough to link this example to a Java Library development environment... A little (irrelevant) example here: if someone calls a function that returns a bool to indicate succesfulness bool bSuccessful = foo(); if ( bSuccessful ) bSuccessful = bar(); by replacing bool with some debug-only bool wrapper, the debugger will breaks everytime someone does the following: bool bSuccessful = foo(); bSuccessful = bar() // BREAKS: bSuccessful reassigned before being checked!! 2010/6/15 Justin Deoliveira <jdeol...@opengeo.org>: > I have to add my +1 as well. We have run up against this before when we > started supporting java 6 and the moral of the story was that it is up > to the downstream developer to ensure that if they are iterating through > a map in a case where order matters then the onus is on them to ensure > they are using an ordered map. > > That and the shear effort to switch from using HashMap to another map > implementation makes it quite a job. I know I use HashMap everywhere. > > Good debate though :) > > -Justin > > On 10-06-15 11:00 AM, Ian Turton wrote: >> On Tue, Jun 15, 2010 at 10:35 AM, Mª®k<mc.pr...@gmail.com> wrote: >>> +1 for Andrea and Christian. >>> >> >> +1 from me too - When I learnt about maps and lists I was taught they >> do different things and to be clear about which I needed. >> >> Ian > > > -- > Justin Deoliveira > OpenGeo - http://opengeo.org > Enterprise support for open source geospatial. > > ------------------------------------------------------------------------------ > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > Geotools-devel mailing list > Geotools-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-devel > -- L I M ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel