-
Notifications
You must be signed in to change notification settings - Fork 15
Refactored datastore session classes #112
base: master
Are you sure you want to change the base?
Conversation
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.
Without getting too much into the details of the PR, I would get rid of the abstract classes and replace them with interfaces. Prefer composition over inheritance. I understand that ManagerBase
and StoreBase
are abstract classes provided by Tomcat which you need to extend. However, KeyValuePeristentManager
and KeyValuePersistentStore
can extend those base classes without themselves being abstract. Instead, they can depend on implementations of the corresponding interfaces that contain the corresponding currently abstract methods. I hope this makes sense.
@meltsufin There are a few points that I think make the inheritance way natural and practical here:
Where I do see an interface making sense would be perhaps at a level above key-value-persistent storage. For example, an interface for arbitrary persistent storage technologies would make sense imho since there could be functionality that a key-value based approach like Memcache doesn't have in common with other non-KV storage. This big SO thread captures this situation pretty well (https://stackoverflow.com/questions/49002/prefer-composition-over-inheritance) |
@ChengyuanZhao I see that inheritance is more natural here due to how Tomcat uses these classes. Thanks for the clarification. I'm generally fine with the change pending @balopat review and integration tests. |
@balopat Can you please do another pass here when you have a chance so we can close this out? Thanks! |
works on #108 ,
Did not add the documentation points from the issue initially. Please take a look at the proposed refactoring :)