You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Lyor Goldstein (Jira)" <ji...@apache.org> on 2020/09/17 09:28:00 UTC
[jira] [Commented] (SSHD-1081) Avoid unused interfaces
[ https://issues.apache.org/jira/browse/SSHD-1081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17197556#comment-17197556 ]
Lyor Goldstein commented on SSHD-1081:
--------------------------------------
{quote}
I think over time, we've added a bunch of interfaces which are not really useful at the end....A good example is imho SessionHolder or ClientSessionHolder which are implemented by a lot of classes but never actually used as a parameter or or variable.
{quote}
My initial drive for these interfaces was heavily influenced from the Spring framework where widespread use of interfaces allows for (IMO) great flexibility. Furthermore, I believe that even if our code might not use these interfaces directly, they do provide our users with a useful framework - which they are free to use (or not).
Basically, my rationale is that if a class/interface is associated with a session/channel/etc. - we should indicate the fact and provide access to it via {{XxxHolder}} interface or similar. IMO, this allows users code to gain access to it without having to complicate their own code if they need this information by having to propagate the information on their own. My view is that whatever information we can safely expose to users we should since we cannot predict how / when they will need it.
Finally, the user of interfaces (IMO) provides easier localized/targeted implementations as each interface concentrates on one feature (and yes, I am aware that we do have some "uber" interfaces that extend many other - but they are few and do not represent the general rule).
> Avoid unused interfaces
> -----------------------
>
> Key: SSHD-1081
> URL: https://issues.apache.org/jira/browse/SSHD-1081
> Project: MINA SSHD
> Issue Type: Improvement
> Reporter: Guillaume Nodet
> Priority: Major
>
> I think over time, we've added a bunch of interfaces which are not really useful at the end.
> Adding interfaces purely to abstract methods is imho not a good idea when they don't represent something which is actually used. It makes the navigation in the code much more difficult when trying to find the correct implementation of a given method. A good example is imho {{SessionHolder}} or {{ClientSessionHolder}} which are implemented by a lot of classes but never actually used as a parameter or or variable.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org