-
Notifications
You must be signed in to change notification settings - Fork 16
Prh90 #19
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
base: master
Are you sure you want to change the base?
Prh90 #19
Conversation
|
@kenrett What we were talking about in tests and using constants |
| RESPONSE1 = "Listen, class, this is how everything works. " | ||
| RESPONSE2 = "*drops crazy knowledge bomb* " | ||
| RESPONSE3 = "... You're welcome." | ||
| TRAINING_SESSION_RESPONSE = "Whoa. I know ruby-fu" |
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.
Alternatively, you can also make a hash here with responses and their values.
response_hash = { response1: "Listen, class, this is how everything works. ", response2: .... }| @age = args.fetch(:age, 0) | ||
| @name = args.fetch(:name, "") | ||
| end | ||
| end No newline at end of file |
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.
Indentation may seem trivial, as the program works whether you're following standard conventions or not. But when you're working on a large project with lots of other people, you want to know that everyone is following the same style guide. Even just looking back on your own code, you'll prefer well formatted code over poorly formatted code! And any workplace with code reviews in place will require that you follow their style guide, so get used to it now.
Make sure to set sublime (or whatever text editor you're using) to have 2-space tabs, since that's what we use in the files we give you, and we like consistency (also, sometimes if you have tabs in some places and spaces in others, it can look right to you, but then look wrong on github).
| def offer_high_five | ||
| "High five!" | ||
| end | ||
| end No newline at end of file |
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.
👍
| RESPONSE1 = "Listen, class, this is how everything works. " | ||
| RESPONSE2 = "*drops crazy knowledge bomb* " | ||
| RESPONSE3 = "... You're welcome." | ||
| TRAINING_SESSION_RESPONSE = "Whoa. I know ruby-fu" |
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.
Constants should be used only when value cannot change during the execution of the script.
Where ever I see a constant I can be sure that its value was not changed anywhere along the way since it being defined.
For eg: the year you were born is a constant, while your postcode is an instance variable
| end | ||
|
|
||
| end | ||
|
|
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.
Indentation needs to be fixed.
@ssachid trying to use constants, can you help me understand the problem.