Skip to content

Conversation

@lnestor
Copy link

@lnestor lnestor commented May 11, 2018

@jaybobo Last one!

@lnestor lnestor changed the title WIP Initial commit Finish challenge May 11, 2018
end

def dead?
!self.alive
Copy link
Member

Choose a reason for hiding this comment

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

You are consistently using the self.attribute for setting/changing values and just the bare attribute for reading values, except this one reader. Maybe change this one to !alive?

Copy link
Member

Choose a reason for hiding this comment

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

@mikegee what's your preference for defining attributes? ivars or using self as done here? And why? :D

Copy link
Member

Choose a reason for hiding this comment

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

I prefer defining the attribute methods and using them exclusively. Instance variables with typos raise no error, Ruby happily returns nil. Method calls with typos raise NoMethodError. I prefer feedback as early as possible.

Copy link
Member

Choose a reason for hiding this comment

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

On this particular line, I suggest removing the self. prefix but continuing to call the reader method.

@mikegee
Copy link
Member

mikegee commented May 14, 2018

Looks great!

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