On 28/03/2015 7:28 AM, Taher Alkhateeb wrote:
Hi Adrian,

Would you not find it useful especially for those not experienced in data 
structures and algorithms not to worry about picking the right implementation 
for a list, map, set, tree or any other data structure by defaulting to what 
the factory would yield? Furthermore, let's say you dislike the HashMap that 
everyone is using and would prefer a different implementation. Would it not be 
a lot faster to change that in one place instead of the thousands upon 
thousands of sprinkled new instantiations?
This seems like a modern way to do things.

I am suggesting a factory just to have sanity and consistency. In fact, when 
looking at the source code I see people using different implementations of the 
interfaces in different places!
A factory will still allow different implementation (as Adrian feels is required) but at least the best practices will be documented and encapsulated in the factory.

Ron

Taher Alkhateeb

----- Original Message -----

From: "Adrian Crum" <adrian.c...@sandglass-software.com>
To: dev@ofbiz.apache.org
Sent: Saturday, 28 March, 2015 1:40:31 PM
Subject: Re: Proposal to introduce factory pattern to java collections

Personally, I am opposed to making simple things like this overly
complicated. It is unlikely the Java collections API will change enough
to warrant a factory for every collection type.

Javolution was used in Java 1.4 to reduce the latency caused by garbage
collection. That is not a problem with JREs >= 1.5, so we don't need the
library any more.

Adrian Crum
Sandglass Software
www.sandglass-software.com

On 3/28/2015 10:01 AM, Taher Alkhateeb wrote:
Hi All,

The move from javolution to the collections API built in to java proves to be painful. To 
avoid such things in the future and to reduce the "new" keyword clutter in the 
code I suggest we create factories for all collections. This way we we can also enhance 
the collections in the future with any ofbiz specific code. This is also a best practice 
in terms of design patterns.

I would like to have opinions on whether this is a wanted / acceptable feature 
so I can create a JIRA accordingly. Your opinions are appreciated.

Taher Alkhateeb.




--
Ron Wheeler
President
Artifact Software Inc
email: rwhee...@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102

Reply via email to