From: Iain A. <ia...@co...> - 2005-03-02 22:10:12
|
I suggested in a previous post using interfaces for primary datatype definitions: one example of how this is done can be found in the Java Collections framework. Here List is an interface which has a number of implementation classes, which differ in their internal representations: ArrayList LinkedList, etc. StockMarket.getIpoPile() has a return type of ArrayList - this class should be free to change its list representation without an API change, which can be achieved by declaring the method to return a List. Personally, I would also make the member variable ipoPile be type List, and initialise it as a 'new ArrayList()' in the first instance. Iain. |