Skip to content
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

Active record pattern implementation #206

Closed

Conversation

stephen-lazarionok
Copy link

No description provided.

@npathai
Copy link
Contributor

npathai commented Aug 14, 2015

I will review it this weekend.

if (this.calculateMagicPower() >= 10.0) {
System.out.println(this.toString() + ": a fireball spell is casted");
} else {
throw new SpellCastException("Can not cast lighting! Not enough magic power...");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A typo here, the message should be Can not cast fireball!.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@npathai
Copy link
Contributor

npathai commented Aug 16, 2015

We should document disadvantages one of them is violation of SRP, the object knows how it is going to be persisted. How do we manage transaction with Active record? ActiceJDBC does it, but I haven't got time to go in depth. Something about transaction should be said because some real applications rely heavily on transactions.

@stephen-lazarionok
Copy link
Author

It's disputable point about SRP violation as we just put all the logic including domain and persistence related to some record into one class.
Transactions management is orthogonal topic that is not really connected to patterns. I think it's not worth mentioning it.

statement.close();
connection.close();
}
catch (final SQLException | ClassNotFoundException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: catch should be in the line of closing try curly brace.

try {
  ...
} catch (Exception ex) {
  ...
}

I personally prefer Google style guide. I will also raise this point in chat room. What do you prefer here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. I do not have any particular preferences :)

@npathai
Copy link
Contributor

npathai commented Aug 18, 2015

Regarding Transaction management, though it is an orthogonal topic but it will affect the implementation. Imagine what would we do if the example was about Account and we had a transaction of money transfer. Then the withdraw() method of Account would not have been able to commit and close the connection. It was because of this that I was wondering if we should mention about transactions.
We have several patterns related to persistence: #55 , #34 #45 , so it is important to compare them and thinking and documenting where each of these patterns shine and have limitations. This will make things clearer in readers mind. Let me know your comments on this.
@iluwatar Maybe you can pitch in here.

@npathai
Copy link
Contributor

npathai commented Aug 20, 2015

@stephen-lazarionok I have a few doubts and need your clarification on them. Please go through my comments and respond. After that I think we are good to go.

@stephen-lazarionok
Copy link
Author

@npathai I commented on your points. I guess it's worth discussing the point about transactions and patterns related to DBs. I checked out other patterns implemented earlier and did not find any references to transactions. My opinion is still that transactions is a separate topic and we should not mix it up with patterns. We could add this information later if needed.

@npathai
Copy link
Contributor

npathai commented Aug 21, 2015

@stephen-lazarionok Yes as far as the previous patterns are concerned, they were created by very few people maybe by @iluwatar and now we have a team. So we can improve upon many fronts. We will be happy to hear your thoughts on transactions on previous patterns as well it's something worth mentioning. Also in future we will be visiting previous patterns and improve upon them.

Open points:

@npathai
Copy link
Contributor

npathai commented Aug 21, 2015

@iluwatar LGTM. If you are satisfied with implementation then we can proceed with README and web site changes.

@npathai
Copy link
Contributor

npathai commented Aug 26, 2015

Any updates @stephen-lazarionok ?

@stephen-lazarionok
Copy link
Author

Sorry, was busy other stuff on my projects. Will take care of that this weekend.

@stephen-lazarionok
Copy link
Author

Had to take care of some urgent stuff this weekend, will do tomorrow.

@npathai
Copy link
Contributor

npathai commented Aug 31, 2015

@stephen-lazarionok Not a problem 👍

@stephen-lazarionok
Copy link
Author

Format code according to Google Style Guide ---> done
Prepare diagram using Eclipse ObjectAid plugin. ---> Need help to generate the diagram
Implement README and website changes ---> done (todo: just need to add the link to the diagram)

@npathai
Copy link
Contributor

npathai commented Sep 2, 2015

@stephen-lazarionok How can I help? Did you face any issue while generating the diagram?

@stephen-lazarionok
Copy link
Author

Will install Eclipse and fix soon. Sorry, do not have enough time as I am in the middle of my trip and also have stuff to do on my projects.

@npathai
Copy link
Contributor

npathai commented Sep 10, 2015

Not an issue :) take ur time..

@iluwatar
Copy link
Owner

This pull request made no progress during the last 30 days, so I will close it.

@iluwatar iluwatar closed this Oct 13, 2015
pratigya0 pushed a commit to pratigya0/java-design-patterns that referenced this pull request Aug 3, 2023
* Added explanation and example of public IP address

* Removed the IP and ISP bit

* Added information about APIPA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants