Naming issue help I have a shared library across ...
# announcements
u
Naming issue help I have a shared library across multiple apps. Lets say it provides
Authenticator
class which has
login()
function Now, app B needs logout as well, so it extends Authenticator and adds
logout()
functionality. How would you call such type? 1) If I were to take inspiration from the way List interface looks I'd call it
LogoutableAuthenticator
But such name looks silly for app B developers, as they only use a
Authenticator
which has both login and logout functions 1.5) Give it app name prefix like
AppBAuthenticator
. Also feels silly. All app B types then should have this prefix 2) Or, design it backwards, leave leaf implementations prefixless, so app B has Authenticator but it extends
BaseAuthenticator
. But this again looks stupid in shared code 3) Name them both Authenticator and let just the package name be different
n
Maybe just provide a single Authenticator class that provides a default noop logout implementation
👍 1
u
Youd still have the same issue as app B needs the feature so it needs to name the type I could how to makes sense to stick lpgout into the shared library and just not use it in other apps, buts that not the poimt of my question
k
org.apache.catalina.Authenticator
v
You could use an extension method in B, so that you don't need a new type but in B the class simply has another method.
u
@Vampire nice idea, flow is kind of like that right? but ill need to use the private / protected vals so no go