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

Add Decorator to my object #2

Merged
merged 3 commits into from
Nov 9, 2022
Merged

Add Decorator to my object #2

merged 3 commits into from
Nov 9, 2022

Conversation

iambenkis
Copy link
Owner

App name : School Library

In this initial step, I implement the classes to represent students and teachers.

Checklist 🥇

  • Person class create ✔️
  • Student class create ✔️
  • Teacher class create ✔️
  • Nameable class create (Interface) ✔️
  • Turn your Person class to Nameable ✔️
  • Decorator base class prepared ✔️
  • CapitalizeDecorator and TrimmerDecorator prepared ✔️

Happy reviewing 👍

Copy link

@mikethreels mikethreels left a comment

Choose a reason for hiding this comment

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

Hi Benjamin,

Good job so far!
There are some issues that you still need to work on to go to the next project but you are almost there!

Highlights

  • linters are passing

Required Changes ♻️

Check the comments under the review.

Optional suggestions

Every comment with the [OPTIONAL] prefix is not crucial enough to stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better.

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me in your question so I can receive the notification.

Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

person.rb Outdated
Comment on lines 2 to 4
def initialize(name)
@nameable = name
end

Choose a reason for hiding this comment

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

  • no need to include the initialize method in this class because there are not instance variables used

person.rb Outdated
Comment on lines 11 to 15
class Decorator < Nameable
def initialize(nameable)
@nameable = nameable
super
end

Choose a reason for hiding this comment

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

  • the attribute accessor should be created for the @nameable instance variable.

person.rb Outdated
Comment on lines 17 to 20
def correct_name
@nameable
end
end

Choose a reason for hiding this comment

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

  • the correct_name method should return the result of the correct_name method of the @namable, which will look something like:
    def correct_name
      @nameable.correct_name
    end

person.rb Outdated
end

def correct_name
return @nameable.correct_name.slice(0, 10) if @nameable.correct_name.length > 10

Choose a reason for hiding this comment

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

  • this method should return the first 10 characters of the #nameable variable however your code is returning the first 11.

person.rb Outdated
Comment on lines 23 to 26
def initialize(nameable)
@nameable = nameable
super
end

Choose a reason for hiding this comment

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

  • it is not necessary to use the initialize method in each class.

person.rb Outdated
Comment on lines 33 to 37
class TrimmerDecorator < Decorator
def initialize(nameable)
@nameable = nameable
super
end

Choose a reason for hiding this comment

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

  • it is not necessary to use the initialize method in each class.

Copy link

@codecaiine codecaiine left a comment

Choose a reason for hiding this comment

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

Hi @iambenkis,

Your project is complete! There is nothing else to say other than... it's time to merge it :shipit:
Congratulations! 🎉

Highlights

  • Good project setup ✔️
  • No linters errors ✔️

Optional suggestions

Every comment with the [OPTIONAL] prefix won't stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better. Some of them were simply missed by the previous reviewer and addressing them will really improve your application.

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me (@codecaiine) in your question so I can receive the notification.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

@iambenkis iambenkis merged commit 31bbe6a into develop Nov 9, 2022
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.

3 participants