-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Jv oop advanced #1737
Conversation
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.
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:
-
Default Figure Specification: Ensure that the
getDefaultFigure()
method inFigureSupplier
returns a white circle with a radius of 10, as per the task requirements. Currently, it returns a circle with a radius of 2. -
Magic Numbers: Replace magic numbers, such as the radius value in
getDefaultFigure()
, with constants for better readability and maintainability. -
Random Value Generation: Consider using
random.nextDouble() * someMaxValue
to generate dimensions within a reasonable range, as usingrandom.nextDouble()
alone may result in very small or zero values. -
Enum String Representation: In the
getDefaultFigure()
method, use the string "White" directly instead ofColor.White.name()
. -
Constructor Expressions: Avoid using expressions directly in constructors. Instead, create separate variables for better readability.
-
Typos in
draw
Method: Correct the typos in thedraw
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! ✨
+ "longerbase " + getLongerBase() + " units, " | ||
+ "shoterbase " + getShorterBase() + " units, " |
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.
There's a typo in the draw
method output: 'shoterbase' should be 'shorterbase'.
+ "firstLeg " + getFirstLeg() + " units, " | ||
+ "secondleg " + getSecondLeg() + " units, " |
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.
There's a typo in the draw
method output: 'secondleg' should be 'secondLeg'.
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()); |
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.
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.
No description provided.