-
-
Notifications
You must be signed in to change notification settings - Fork 546
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
beer-song: Update to test property recite #984
Conversation
After re-reading the issue I need to update to |
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.
I believe the verse number has nothing to do with the number of bottles of bear on the wall. There are 99 bottles of beer on the wall at the beginning of the song. A song begins at its first verse.
Verses are ascending while bottles of beer on the wall is descending.
Would There are some things to think about here. |
I think that it would. I reviewed my solution to this problem. (I should have done that before I submitted my review.) My implementation passes in the number of bottles and not the verse number, and thus effectively passes in start bottles and end bottles. I will update my review of this PR. |
@Insti's suggestion of using start bottles
and end bottles
in my opinion fixes the issue I had.
|
"number": 99, | ||
"property": "recite", | ||
"start verse": 99, | ||
"end verse": 99, |
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.
Consider startBottles
and endBottles
instead. Same for all occurrences later in this files.
@@ -1,4 +1,4 @@ | |||
Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall. |
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.
lyrics
was OK.
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.
#983 calls for standardizing the descriptions as well as the property name which is why I made this change.
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.
#983 calls for standardizing the descriptions as well as the property name
Hmm I didn't notice that :)
I like lyrics better than verses here tbh.
"start verse": 3, | ||
"end verse": 3, | ||
"startBottles": 3, | ||
"endBottles": 3, | ||
"expected": "3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n" | ||
}, | ||
{ | ||
"description": "verse 2", |
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.
Since we are not strictly talking verses anymore, perhaps this should be:
"description": "2 bottles of beer",
or something to the affect.
Similar changes would be needed for the other cases.
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.
I'd prefer to change this to verse with 2 bottles
because we have first generic verse
and last generic verse
which are more explicit than 99 bottles of beer
and 3 bottles of beer
in terms of why those test cases were chosen. Thoughts?
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.
I like it. Thanks.
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.
Updated!
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.
Thanks @robkeim
exercises/beer-song/description.md
Outdated
@@ -1,4 +1,4 @@ | |||
Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall. | |||
Recite the verses to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall. |
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.
The change to Recite
is good.
"Recite the lyrics" is better (and more consistent) than "Recite the verses"
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.
Done
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.
thanks.
"number": 99, | ||
"property": "recite", | ||
"startBottles": 99, | ||
"endBottles": 99, |
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 are 98 bottles left on the wall at the end...
"description": "verse with 0 bottles", | ||
"property": "recite", | ||
"startBottles": 0, | ||
"endBottles": 0, |
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 are 99 bottles on the wall at the end.
Maybe startBottles and endBottles doesn't make sense for this problem.
startBottles and takeDowns? perhaps.
(Trying to work out what's best here, not advocating changes just yet.)
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.
takeBottles
? bottlesToTake
?
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.
Whatever it is we're diverging from the common specification, but I think that is OK as this is a separate exercise with its own nuances.
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.
For the first two verses are you suggesting:
"startBottles": 99,
"takeDowns": 2,
or
"startBottles": 99,
"takeDowns": 98,
The first makes more sense to me but that's moving away in consistency with the other exercises unfortunately. If we're going to head down that direction, I think numVerses
would be more explicit.
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.
Woops... just read your other comments you're one step ahead of me :)
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.
Should the words in the lyrics dictate that naming of the properties?
When we get down to zero beers on the wall, the only reason there ends up being 99 bottles of beer on the wall is because the lyrics say to go buy more beer.
To trigger a trip to the store, endBottles
has to be zero.
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.
I'm actually suggesting:
"startBottles": 99,
"takeDowns": 1,
Grabbing lunch.... you bring up a good point. TakeDown would be less disruptive than endBottles.
Sent from my android device.
|
I have to correct myself. The above is not a true statement. The way the exercise is implemented is the start number of bottles and the resulting number of bottles are passed in as parameters. So I say stick with |
That is an unnecessary implementation detail. The test needs to specify, the number of bottles that begin on the wall This also works in the zero wrap around case where we can start with 0 and take 1 down and end at 99 again. If we were to take more than 1 we could still expect the right answer. If you REALLY wanted to maintain consistency (which you shouldn't) the thing to do would be to update the other exercises to take In this case breaking consistency with the way the other exercises are implemented is a good thing. |
@Insti I am coming around to your way of seeing this exercise. These changes accentuate the perpetual nature behind this song..... It never ends. 😄 |
With
And ensure that it looped through twice. This would not be possible with the start/end pair. (I don't recommend adding this test either.) |
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.
All the takeDown
s look fine to me.
Looks good. 👍 |
@robkeim, Just waiting on this one now. If you don't have time we can merge this PR and do the line adjustments as a new PR. |
@Insti I should be able to get to this on Sunday. You can either merge this as is or wait for that update. |
@Insti I couldn't sleep so I took advantage of the extra time to wrap-up this PR :) It should be ready for you to merge. |
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.
Looks good, thanks @robkeim
Thanks for all your work on this @robkeim ❤️ |
You're welcome @Insti, thanks for the feedback! |
Addresses #983
Note:
@Insti FYI