Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Zookeeper, mail # dev - Get rid of unnecessary Interfaces


Copy link to this message
-
Get rid of unnecessary Interfaces
Thomas Koch 2011-09-23, 08:16
Hi,

there are some interfaces in the ZK code that have only one implementation. I
propose to get rid of the interfaces and use the classes directly:

org.apache.zookeeper.server.Stats
org.apache.zookeeper.server.persistence.SnapShot
org.apache.zookeeper.server.persistence.TxnLog

There are other interfaces, named *Bean, which seem to be necessary, but I
don't know about beans.

Rationale:
http://www.symphonious.net/2011/06/18/the-single-implementation-fallacy/
http://rrees.wordpress.com/2009/01/31/programming-to-interfaces-anti-pattern/

tl;dr:
- Browsing the code gets harder since the IDE always jumps to the interface,
instead of to the implementation.
- Changing the method signatures involves changing the interface and the
class.
- There are more things in the code base to confuse you.

May I fill an issue and upload a patch?

Regards,

Thomas Koch, http://www.koch.ro
+
Tom Klonikowski 2011-09-23, 09:31
+
Benjamin Reed 2011-09-23, 14:10
+
Patrick Hunt 2011-09-23, 15:39