New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/524/interface consistency #545
base: master
Are you sure you want to change the base?
Feat/524/interface consistency #545
Conversation
… more logging for insight into validation and merkle tree operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of the Interface
suffix and would prefer using Default[ClassName]
& keeping the Interface name as the abstract concept. I think Default
is probably more descriptive than Base
which is what we were using before.
That being said, I'm also a fan of not using interfaces for single implementations. There are long discussions about the pros and cons of this here which boil down to making mocking for tests easier if you have an interface for literally everything.
My preference when writing code is keeping as much fluff out as possible and I think that using Hungarian notation adds a bit of fluff & can promote busy-work style coding. There's a snippet from an article about interface naming which I like:
Think About Your Design!
You will probably encounter three different situations:
1. Your current code needs multiple implementations of a same concept.
2. Your current code provides one implementation of a concept, but is meant to be extended by more specialized third-party code.
3. Your current code only needs a single implementation, and there’s currently no point in extending it.
It then goes over different ways to handle the interface for each scenario. #3 is obviously the hardest where you end up wanting to call your interface the same thing as your implementation. In these cases Default
or Impl
or Base
, or even not writing an interface all are reasonable options. This way we're only adding a non-descriptive prefix/suffix some of the time as opposed to adding extra syntax all the time.
All of this said, I also don't like bike shedding naming. So even if we were to use the Interface
suffix it's certainly not the end of the world.
@@ -33,7 +33,7 @@ export class BaseBucket implements Bucket { | |||
|
|||
/** | |||
* Sets the value at a given key. | |||
* @param key Key to set. | |||
* @param key KeyInterface to set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be Key
not KeyInterface
I believe
Description
Makes interfaces consistent. Use descriptive implementation name where possible. If meant to be a single-implementation interface or there is no easy descriptive name,
class SomeName implements SomeNameInterface
.Metadata
Fixes
Contributing Agreement