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

Feature/moneydesignpattern #2654

Closed

Conversation

hheanly123
Copy link

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.

hheanly123 and others added 30 commits October 15, 2023 16:11
@sonarcloud
Copy link

sonarcloud bot commented Oct 27, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link

stale bot commented Nov 26, 2023

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.

@stale stale bot added the status: stale issues and pull requests that have not had recent interaction label Nov 26, 2023
@@ -0,0 +1,51 @@
title: com.iluwatar.Money Design Pattern
Copy link
Owner

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:
Copy link
Owner

Choose a reason for hiding this comment

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

Comment on lines +10 to +15
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.
Copy link
Owner

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")

Copy link
Owner

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

Comment on lines +20 to +25
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.8.0</version>
<scope>test</scope>
</dependency>
Copy link
Owner

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>
Copy link
Owner

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

Comment on lines +5 to +10
/**
* 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.
*/
Copy link
Owner

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);
Copy link
Owner

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) {
Copy link
Owner

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

Comment on lines +67 to +69
public long getAmount() {
return amount;
}
Copy link
Owner

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

@stale stale bot removed status: stale issues and pull requests that have not had recent interaction labels Dec 28, 2023
@iluwatar iluwatar added status: under review status: stale issues and pull requests that have not had recent interaction labels Dec 28, 2023
@stale stale bot removed the status: stale issues and pull requests that have not had recent interaction label Dec 28, 2023
Copy link

stale bot commented Jan 27, 2024

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.

@stale stale bot added the status: stale issues and pull requests that have not had recent interaction label Jan 27, 2024
Copy link

stale bot commented Mar 12, 2024

Closed due to inactivity. Thank you for your contributions.

@stale stale bot closed this Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: stale issues and pull requests that have not had recent interaction status: under review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants