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

Fix duplicate files and wrong identation #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bit172
Copy link

@bit172 bit172 commented Apr 1, 2021

This PR closes #1.

Hope this helps with the code quality!

bit172 added 2 commits March 31, 2021 19:59
- ArithmeticOperation.java
- ArithmeticOperationTest.java

Ref moar82#1
Copy link

@osahtout osahtout left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@cristian-aldea cristian-aldea left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you for working on this. However, I had some more suggestions if its not too much to ask

Comment on lines +12 to +14
Integer actual = operations.addOrSub(2, 6);
Integer expected = 8;
assertEquals(expected, actual);

Choose a reason for hiding this comment

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

💡 Same for the one below

Suggested change
Integer actual = operations.addOrSub(2, 6);
Integer expected = 8;
assertEquals(expected, actual);
assertEquals(8, operations.addOrSub(2, 6));

@@ -2,8 +2,7 @@

public class ArithmeticOperation {

public Integer addOrSub(Integer a, Integer b)
{
public Integer addOrSub(Integer a, Integer b) {
if (a > b) {

Choose a reason for hiding this comment

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

Might as well shorten this code in the interest of quality :^)

Instead of

if (a > b) {
        return a - b;
} else {
	return a + b;
}

Do

return a > b ? a - b : a + b;

Copy link
Owner

Choose a reason for hiding this comment

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

Might as well shorten this code in the interest of quality :^)

Instead of

if (a > b) {
        return a - b;
} else {
	return a + b;
}

Do

return a > b ? a - b : a + b;

Not agree with this. The use of the ternary operation affects code readability is not a recommended practice.

Choose a reason for hiding this comment

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

Ah my bad you're right, nevermind my comment then

Copy link
Author

@bit172 bit172 Apr 2, 2021

Choose a reason for hiding this comment

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

I agree. Unless you are a 10x developer, those changes would affect code readability.

Copy link

@ak-nichita ak-nichita left a comment

Choose a reason for hiding this comment

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

looks good

gfdb added a commit to gfdb/ArithmeticOperation that referenced this pull request Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Fix duplicate files and wrong identation
5 participants