You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.
We can see that there's a violation on the Liskov Principle from SOLID because the close method is used in H2DataStore to close the connection with the DB, but it is not used in the MemoryDatastore class. I mean, this is a behaviour that is not shared by the MemoryDatastore class. Therefore, we can see that this method shouldn't be at the Datastore Interface.
You can make another interface called DataStoreDB where you can have the close method and extends from the DataStore interface. Then you can implement the DataStore Interface on the MemoryDataStore class and implement the DataStoreDB Interface on the H2DataStore Interface.
(Recomendation made for educational purposes)
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
DataStore Interface
https://github.com/axhixh/cacofonix/blob/master/src/main/java/gaul/cacofonix/store/Datastore.java
H2Datastore Class
https://github.com/axhixh/cacofonix/blob/master/src/main/java/gaul/cacofonix/store/H2Datastore.javaç
MemoryDatastore Class
https://github.com/axhixh/cacofonix/blob/master/src/main/java/gaul/cacofonix/store/MemoryDatastore.java
We can see that there's a violation on the Liskov Principle from SOLID because the close method is used in H2DataStore to close the connection with the DB, but it is not used in the MemoryDatastore class. I mean, this is a behaviour that is not shared by the MemoryDatastore class. Therefore, we can see that this method shouldn't be at the Datastore Interface.
You can make another interface called DataStoreDB where you can have the close method and extends from the DataStore interface. Then you can implement the DataStore Interface on the MemoryDataStore class and implement the DataStoreDB Interface on the H2DataStore Interface.
(Recomendation made for educational purposes)
The text was updated successfully, but these errors were encountered: