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

beer-song: Update to test property recite #984

Merged
merged 7 commits into from
Nov 5, 2017

Conversation

robkeim
Copy link
Contributor

@robkeim robkeim commented Oct 30, 2017

Addresses #983

Note:

  • The end verse value is numerically less than the start verse for multi-verse tests which may seem counter-intuitive but makes sense given the song counts down from 99 to 0

@Insti FYI

@robkeim
Copy link
Contributor Author

robkeim commented Oct 30, 2017

After re-reading the issue I need to update to "start verse" and "end verse" instead of "startVerse" and "endVerse"

Copy link
Member

@rpottsoh rpottsoh left a 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.

@Insti Insti changed the title Update beer-song to test property recite beer-song: Update to test property recite Oct 30, 2017
@Insti
Copy link
Contributor

Insti commented Oct 30, 2017

Would start bottles and end bottles make more sense for this exercise?

There are some things to think about here.

@rpottsoh
Copy link
Member

Would start bottles and end bottles make more sense for this exercise?

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.

@rpottsoh rpottsoh dismissed their stale review October 30, 2017 15:09

@Insti's suggestion of using start bottles and end bottles in my opinion fixes the issue I had.

@robkeim
Copy link
Contributor Author

robkeim commented Oct 30, 2017

start bottles and end bottles would make more sense although it's not consistent with the other three verse exercises then. It's probably a better approach than having to do math to figure out which verse corresponds to how many bottles.

"number": 99,
"property": "recite",
"start verse": 99,
"end verse": 99,
Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

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

lyrics was OK.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@robkeim
Copy link
Contributor Author

robkeim commented Oct 30, 2017

@Insti and @rpottsoh updated to startBottles and endBottles.

"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",
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

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

I like it. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

Copy link
Member

@rpottsoh rpottsoh left a comment

Choose a reason for hiding this comment

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

Thanks @robkeim

@@ -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.
Copy link
Contributor

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"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

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,
Copy link
Contributor

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,
Copy link
Contributor

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.)

Copy link
Contributor

Choose a reason for hiding this comment

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

takeBottles? bottlesToTake?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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 :)

Copy link
Member

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.

Copy link
Contributor

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,

@rpottsoh
Copy link
Member

rpottsoh commented Oct 30, 2017 via email

@rpottsoh
Copy link
Member

TakeDown would be less disruptive than endBottles.

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 startBottles and endBottles.

@Insti
Copy link
Contributor

Insti commented Oct 30, 2017

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 startBottles and endBottles.

That is an unnecessary implementation detail.

The test needs to specify, the number of bottles that begin on the wall startBottles and the number of verses to output. There are various ways to specify this, but using the language of the song seems like the most appropriate, therefore take n (down).

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 startVerses and numberOfVerses parameters.
(But don't do this.)

In this case breaking consistency with the way the other exercises are implemented is a good thing.

@rpottsoh
Copy link
Member

@Insti I am coming around to your way of seeing this exercise. These changes accentuate the perpetual nature behind this song..... It never ends. 😄

@Insti
Copy link
Contributor

Insti commented Oct 30, 2017

With takeDown one could also specify a test that was

"startBottles": 99,
"takeDown": 200,

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.)

@robkeim
Copy link
Contributor Author

robkeim commented Oct 31, 2017

@Insti and @rpottsoh I've updated to takeDown. Please double check I didn't make a silly off-by-one error :)

Copy link
Member

@rpottsoh rpottsoh left a comment

Choose a reason for hiding this comment

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

All the takeDowns look fine to me.

@Insti
Copy link
Contributor

Insti commented Oct 31, 2017

Looks good. 👍
One last thing..
In food-chain, house and twelve-days we return an array of strings rather than a single newline separated string. Can you add another commit that converts the expected values to that format please?

@Insti
Copy link
Contributor

Insti commented Nov 2, 2017

@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.

@robkeim
Copy link
Contributor Author

robkeim commented Nov 3, 2017

@Insti I should be able to get to this on Sunday. You can either merge this as is or wait for that update.

@robkeim
Copy link
Contributor Author

robkeim commented Nov 3, 2017

@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.

Copy link
Member

@rpottsoh rpottsoh left a 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

@Insti Insti merged commit ddb52e6 into exercism:master Nov 5, 2017
@Insti
Copy link
Contributor

Insti commented Nov 5, 2017

Thanks for all your work on this @robkeim ❤️

@robkeim robkeim deleted the recite-canonical-data branch November 5, 2017 16:10
@robkeim
Copy link
Contributor Author

robkeim commented Nov 5, 2017

You're welcome @Insti, thanks for the feedback!

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.

4 participants