Skip to content
This repository has been archived by the owner on Jun 22, 2021. It is now read-only.

Add ResponseBuilder to build status line #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emilsoman
Copy link
Contributor

  • Response class to encapsulate response data

* Response class to encapsulate response data
end

def set_status_line(status)
http_version = @response.http_version
Copy link

Choose a reason for hiding this comment

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

generally it is a good idea to use the accessor outside the initialize function. ie. response rather than @response
although, in microbenchmarks @response will have better performance than response

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In terms of communication, I like to think that @attribute says "i'm an instance variable" where as the accessor method says "looks like somebody has set an accessor for an instance variable by my name, but double check just to be sure" . For that reason I prefer using @attribute inside the class and the accessor method on objects of the class .

Copy link
Member

Choose a reason for hiding this comment

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

sounds good. off topic: one concern that i have using @attribute is, its hard to catch typos. i can mistype it as @attribtue and it still works most of the places.

Copy link

Choose a reason for hiding this comment

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

do not have a strong opinion here.
but for object-oriented code. acccessors are almost always a good idea. because we can mixin code.

do not think it says much for code "communication" but that is just me

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants