db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <to...@first.fhg.de>
Subject Re: Vector use
Date Mon, 14 Jun 2004 19:01:36 GMT
Robert Sfeir wrote:

> I guess what bugs me the most about Vector is that it's synchronized, 
> and while I am not extremely familiar with the code, there are some 
> spots which look like we don't need synchronization, and we could 
> benefit from the added performance.
> 
> The other thing is that since Vector has been retrofitted to implement 
> Collection, when we have a line like:
> 
> private Vector foo = new Vector();
> 
> wouldn't it be better to use something like:
> 
> private List foo = new Vector();
> or
> private Collection foo = new Vector();
> 
> (Depending on the purpose of course being listed v/s non discriminatory)
> 
> which should allow us to support people using 1.2 + in any case, then we 
> can change our implementation underneath as we go forward and not affect 
> the code.  We can apply changes to the impl as we properly determine 
> sync need v/s none, and choose a better Collection when we see the need.
> 
> Thoughts?
>

To be completely honest with you, usage of Vector and Hashtable doesn't 
really bug me. Of course we can replace them as we change code for some 
other reason, but hunting them does not seem worthwile to me if there is 
no real incentive for it (e.g. a big performance boost because a vector 
is used in a core spot where an array list would be faster). How about 
profiling OJB after the 1.0 is out ?
Also I have a somewhat uneasy feeling about declaring a variable with 
one type and initializing it with another type when this is the only 
type that the actual value will ever have. I personally prefer to be as 
precise as possible about the (possible) types of a value. IMO we should 
use the interfaces explicitly only for public or protected features.

Tom


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


Mime
View raw message