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

Jv oop advanced #1737

Conversation

serhii-slobodianiuk
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Great job on implementing the logic for creating and drawing figures! Your code demonstrates a solid understanding of object-oriented principles and interfaces. However, there are a few areas for improvement:

  1. Default Figure Specification: Ensure that the getDefaultFigure() method in FigureSupplier returns a white circle with a radius of 10, as per the task requirements. Currently, it returns a circle with a radius of 2.

  2. Magic Numbers: Replace magic numbers, such as the radius value in getDefaultFigure(), with constants for better readability and maintainability.

  3. Random Value Generation: Consider using random.nextDouble() * someMaxValue to generate dimensions within a reasonable range, as using random.nextDouble() alone may result in very small or zero values.

  4. Enum String Representation: In the getDefaultFigure() method, use the string "White" directly instead of Color.White.name().

  5. Constructor Expressions: Avoid using expressions directly in constructors. Instead, create separate variables for better readability.

  6. Typos in draw Method: Correct the typos in the draw method outputs: 'secondleg' should be 'secondLeg', and 'shoterbase' should be 'shorterbase'.

These improvements will enhance the functionality and readability of your code. Keep up the good work, and make sure to address these issues in future projects to avoid similar problems. Your effort and dedication to learning are commendable! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +28 to +29
+ "longerbase " + getLongerBase() + " units, "
+ "shoterbase " + getShorterBase() + " units, "

Choose a reason for hiding this comment

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

There's a typo in the draw method output: 'shoterbase' should be 'shorterbase'.

Comment on lines +25 to +26
+ "firstLeg " + getFirstLeg() + " units, "
+ "secondleg " + getSecondLeg() + " units, "

Choose a reason for hiding this comment

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

There's a typo in the draw method output: 'secondleg' should be 'secondLeg'.

Comment on lines +13 to +17
Figure circle = new Circle(colorSupplier.getRandomColor(), random.nextDouble());
Figure rectangle = new Rectangle(colorSupplier.getRandomColor(), random.nextDouble(), random.nextDouble());
Figure isoscelesTrapezoid = new IsoscelesTrapezoid(colorSupplier.getRandomColor(), random.nextDouble(), random.nextDouble(), 4);
Figure rightTriangle = new RightTriangle(colorSupplier.getRandomColor(), random.nextDouble(), random.nextDouble());
Figure square = new Square(colorSupplier.getRandomColor(), random.nextDouble());

Choose a reason for hiding this comment

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

Using random.nextDouble() for dimensions may result in very small or zero values, which might not be suitable for figures. Consider using random.nextDouble() * someMaxValue to ensure the dimensions are within a reasonable range.

@serhii-slobodianiuk serhii-slobodianiuk closed this by deleting the head repository Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants