-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Dirty Flag pattern #560 #717
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
Conversation
Bringing fork up-to-date
@iluwatar I will pick up this review. |
@iluwatar Done. |
Seems to be a JUnit test failure:- dummyCustomerApiTest() Time elapsed: 0.052 sec <<< FAILURE! Doesn't seem to be related to my changes here. |
It is a known issue #643, still unresolved |
@npathai please review the PR |
@iluwatar Yes started. Will complete today |
return data; | ||
} | ||
|
||
return null; |
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 am not sure if DataFetcher should be returning null
to indicate no change in data. Any other options for this?
* @return World instance | ||
*/ | ||
public static World getInstance() { | ||
if (world == null) { |
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.
Suggestion: Just document a warning that this is not a thread safe way to implement Singleton. Refer to Singleton for more information.
* | ||
* @return DataFetcher instance | ||
*/ | ||
public static DataFetcher getInstance() { |
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.
Question: I don't understand the intent to keep World
and DataFetcher
singleton here. Any particular reason you chose this way?
|
||
@BeforeEach | ||
public void reset() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { | ||
Field instance = DataFetcher.class.getDeclaredField("df"); |
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 singleton reset thing won't be needed if we avoid getInstance
. Hence my question about Singletonness.
To avoid expensive re-acquisition of resources. The resources retain their identity, are kept in some | ||
fast-access storage, and are re-used to avoid having to acquire them again. | ||
|
||
 |
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.
The class diagram should be made with ObjectAid eclipse plugin. More about it in wiki
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.
Done.
@waisuan You have my review comments. Overall it looks great and easy to follow. 👍 There are a few points that I have highlighted though. Awaiting your response. |
@waisuan Any updates? |
@npathai Apologies for the delay here. Been swamped. I'll take a look at your comments tonight and begin working on them accordingly. Cheers! |
@npathai -- Fixes are up. Could you take another peek? Thanks! |
@waisuan 👍 Surely. I will do that tomorrow. |
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.
There was one minor change, but lets merge this now and we can do that minor change later.
public void testIsDirty() { | ||
DataFetcher df = new DataFetcher(); | ||
List<String> countries = df.fetch(); | ||
assertTrue(!countries.isEmpty()); |
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.
Use assertFalse()
in place of assertTrue(!condition)
Uh oh!
There was an error while loading. Please reload this page.