Iterators/vectors (was: [Biocorba-l] BSANE and bioCORBA)

Juha Muilu muilu@ebi.ac.uk
Fri, 01 Jun 2001 11:16:46 +0100


Hi Antoine,  
Nice to have you on the list!

So we will keep the iterator/list pattern as used in the BSA. 

I have found it quite good to implement and use.


Antoine van Gelder wrote:
> 
> On 31 May 2001 23:39:19 +0100, Martin Senger wrote:
> >   Although I thing that it is not big issue I feel that implementation
> > with 'out' parameter and returning boolean is easier and also it saves one
> > network call.
> >    I do not like raising any Exception as a "normal" behaviour - that
> > makes the codeclumsy and less readable.
> 
> Iterator patterns that return bool are much cleaner as it allows for
> code such as:
> 
> Object obj;
> while (someIterator.next(&obj)) {
>   obj.dostuff();
> }
> 
> Instead of:
> 
> while (someIterator.has_more()) {
>   Object obj = someIterator.theObject();
> }
> 
> Which is heavier on both network calls and object constructor calls.
> 
> Or even worse if I understood Brad correctly:
> 
> try {
>   while (someIterator.hasNext()) {
>     SomeObj obj = someIterator.the_object();
>   }
> } catch (SomeException) {
>   // extremely cpu expensive way of ending a loop adding huge
>   // overhead to even the simplest algorithm not to mention
>   // the pain you cause in terms of memory management for
>   // c++ developers.
> }
> 
>  - a
> 
> _______________________________________________
> Biocorba-l mailing list
> Biocorba-l@biocorba.org
> http://www.biocorba.org/mailman/listinfo/biocorba-l

-- 
 +--------------------------------------------------------------------+
 |Juha Muilu, Ph.D., EMBL Outstation| Email:  muilu@ebi.ac.uk         |
 |European Bioinformatics Institute | Phone:  +44 (0)1223 494 624     |
 |Wellcome Trust Genome Campus      | Fax:    +44 (0)1223 494 468     |
 |Hinxton, Cambridge CB10 1SD, UK   | http://industry.ebi.ac.uk/~muilu|
 +--------------------------------------------------------------------+