zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Umesh Panchaksharaiah (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ZOOKEEPER-2630) Use interface type instead of implementation type when appropriate.
Date Fri, 14 Apr 2017 20:41:41 GMT

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-2630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15969502#comment-15969502
] 

Umesh Panchaksharaiah commented on ZOOKEEPER-2630:
--------------------------------------------------

Hi Michael,

How did you find all the instances for replacements? One way is the brute
force method of looking at each declaration of HashMap / HashSet and see if
the usage is confined to Map / Set interface methods.  Is there a more efficient
way to find all the instances of replacement using perhaps Eclipse? (An Eclipse
newbie and hence the question?).  Thank you. -Umesh

> Use interface type instead of implementation type when appropriate.
> -------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2630
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2630
>             Project: ZooKeeper
>          Issue Type: Improvement
>            Reporter: Michael Han
>            Priority: Trivial
>              Labels: newbie, refactoring
>
> There are a couple of places in code base where we declare a field / variable as implementation
type (i.e. HashMap, HashSet) instead of interface type (i.e. Map, Set), while in other places
we do the opposite by declaring as interface type. A quick check indicates that most if not
all of these places could be updated so we have a consistent style over the code base (prefer
using interface type), which is also a good coding style to stick per best practice.
> See more info on https://github.com/apache/zookeeper/pull/102



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message