Boris is right of course. That's the main reason that I was thinking when I said that. 
There's definitely no need for the overhead of synchronization in the case that we 
were discussing. Another reason that I was thinking about, but didn't elude to very 
well is that you should always try to declare variables as Interface types, rather 
than concrete classes. So instead of declaring:

Vector items = new Vector();

you should instead use the List interface, which the Vector is one of the implementors 
of:

List items = new Vector();

What's nice about dealing with interface types instead, especially if you isolate 
where your objects are instantiated is that you are then free to change the 
implementation type like this:

List items = new ArrayList();

Any client that used this items List is not affected as long as they deal with the 
interface type and not the concrete implementation. This is a big bonus.

Look through the Java API's and you'll see many factories taking advantage of this 
concept. Like JNDI, JMS, and JDBC. This is why I said that, but I should have 
elaborated more on the subject.

Sorry,
Chuck
--
Sent via jApache.org

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to