2018-05-31 19:59 GMT+02:00 Lyor Goldstein <lgoldst...@apache.org>:

> >>>  > I disagree with the characterization that they do not have a "real
> concept
> > behind them" they represent contracts of entities that have similar
> > attributes. IMO, all the various *XxxHolder*(s) represent an entity that
> > provides whatever these "attribute" interfaces hold.
>
> >>>  Well, I would agree on this principle in theory.
> However, I've seen no evidence throughout the code that this is actually
> useful.
>
> Here is something that I see as a useful consequence of these "marker"
> interfaces - some degree of standardization: e.g., if more than 1 entity
> displays the same "behavior" and/or "attributes", it makes sense to call
> them by some standard name - e.g., avoid *getSession, getClientSession,
> getCurrentSession, getEstablishedSession* in different entities that
> basically expose a *ClientSession*. To me it is another aspect of the
> D.R.Y. principle since it makes it easier to search for code that refers to
> a known entity knowing that it will use a standard way to expose it.
>

I fully understand that it's the reason why they have been introduced.
But I think that's somewhat wrong.  The most obvious example to me is the
  SessionHolder / ClientSessionHolder / ServerSessionHolder
or the NamedResource#getName.
Those are actually never used (on the interface), because almost every time
when the method is used, it's inside the class implementation itself, so the
interface is not used.
I actually found the use of the interface very annoying because whenever I
want
to find where the getSession() is used, I end up with *all* references to
the
SessionHolder, so basically, all calls to getSession() in the whole code
base.
That make search for method usage quite useless.


-- 
------------------------
Guillaume Nodet

Reply via email to