I wholeheartedly agree.  This is really just good style in general.

Maybe we should seriously consider a FOP developer coding standard and start writing 
it down and putting it on the site.  I'd offer to help with that.

-----Original Message-----
From: Jeremias Maerki [mailto:dev.jeremias@;greenmail.ch]
Sent: Wednesday, November 06, 2002 10:19 AM
To: [EMAIL PROTECTED]
Subject: interface instead of implementation


Fellow FOP developers,

would you mind using the interface instead of the implementation where
possible? Map instead of HashMap, List instead of ArrayList. I've seen
this habit in a number of places and not only by Keiron! I've made it a
habit to follow this pattern:

import java.util.List;

[..]

private List myvalues = new java.util.ArrayList();

ArrayList never gets imported. That makes it easier to switch between
implementation, for example if you have to switch between the
unsynchronized ArrayList and the synchronized Vector. The decision which
implementation to take should happen at one place in the code, not at
many places. For Map there exist new implementations in Jakarta Commons
Collections, for example. A method that takes List parameters (instead
of ArrayList) is more universal.

Thank you all!

On 6 Nov 2002 15:07:04 -0000 keiron wrote:
>   +
>   +    /**
>   +     * Traits for this area stored in a HashMap
>   +     */
>   +    protected HashMap props = null;

Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to