-
-
Notifications
You must be signed in to change notification settings - Fork 26.6k
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
Feature/moneydesignpattern #2654
Feature/moneydesignpattern #2654
Conversation
…r commenting to Money.java
… feature/moneydesignpattern
… feature/moneydesignpattern # Conflicts: # money/README.md
Kudos, SonarCloud Quality Gate passed! |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
@@ -0,0 +1,51 @@ | |||
title: com.iluwatar.Money Design Pattern |
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 suggest we remove this other title and use the one below
title: Money Design Pattern | ||
category: Functional | ||
language: en | ||
tag: |
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.
Are there any tags we could use from https://github.com/iluwatar/java-design-patterns/wiki/07.-Categories-and-Tags ?
The com.iluwatar.Money Design Pattern, initially defined by Martin Fowler and detailed in "Patterns of Enterprise Application Architecture," | ||
is a pattern designed to represent value-unit pairs effectively. It's commonly referred to as the "com.iluwatar.Money Pattern" because it was originally | ||
The Money Design Pattern, initially defined by Martin Fowler and detailed in "Patterns of Enterprise Application Architecture," | ||
is a pattern designed to represent value-unit pairs effectively. It's commonly referred to as the "Money Pattern" because it was originally | ||
introduced in the context of financial applications. This pattern aims to handle various aspects of working with money, including currency | ||
conversions, mathematical operations, and more. |
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 suggest we just talk about the money design pattern and leave out com.iluwatar
conversions, mathematical operations, and more. | ||
## Class diagram | ||
![alt text](./etc/money.png "com.iluwatar.Money") | ||
|
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.
Would be nice to implement the explanation section as well
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<version>7.8.0</version> | ||
<scope>test</scope> | ||
</dependency> |
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.
Hmm, not sure why we need this? Is Junit not sufficient?
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>1.7.32</version> |
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 is already present in the parent pom.xml, so we can leave out the version
/** | ||
* The Main class is an entry point for the application that demonstrates | ||
* financial account operations using the Account, Currency, and Money classes. | ||
* It creates accounts, performs deposit and allocation operations, and | ||
* displays the account balances. | ||
*/ |
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.
Here, above the main class
- Introduce the money pattern briefly
- Explain how the example code implements it
* @param args Command-line arguments. | ||
*/ | ||
public static void main(final String[] args) { | ||
final Logger logger = LoggerFactory.getLogger(App.class); |
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.
We can use Lombok annotation for logging
* @param amon The amount of money. | ||
* @param curr The currency associated with the money amount. | ||
*/ | ||
public Money(final long amon, final Currency curr) { |
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.
We can use Lombok annotation to generate the constructor
public long getAmount() { | ||
return amount; | ||
} |
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 Lombok to get rid of boilerplate methods like this
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Closed due to inactivity. Thank you for your contributions. |
Pull Request Title: Implement Money Design Pattern (#1305)
Pull Request Description:
This pull request addresses issue #1305 and introduces an implementation of the Money Design Pattern to the java-design-patterns community. Here are the main features included in this pull request:
Enhanced Money Operations: Added the Money, Currency, and Accounts class to manipulate money across different accounts and currencies. The App class acts as an entry point to depict how the classes function.
Testing: UnitTests have been provided for each of the interacting classes.
README.md: Has the relevant information regarding definitions and use cases for the pattern.
Additional Information:
This pull request aims to allow for the use of the Money design pattern within the java-design-patterns repository. We believe that these changes will improve the overall user experience and understanding of the pattern.
For further details on the changes made, please refer to the individual commits in this pull request.
Contributors and maintainers, please review this pull request, provide feedback, and suggest any further improvements. Thank you for your time and consideration.