Skip to content

Beer song: Tests pass without modification #560

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

Closed
lpil opened this issue Jun 15, 2017 · 10 comments
Closed

Beer song: Tests pass without modification #560

lpil opened this issue Jun 15, 2017 · 10 comments

Comments

@lpil
Copy link
Member

lpil commented Jun 15, 2017

Hello!

When the beer song is downloaded it comes with an implementation that passes all the tests. This seems incorrect to me.

Cheers,
Louis

@rbasso
Copy link
Contributor

rbasso commented Jun 15, 2017

This is the expected behavior, @lpil, as described in the Hints section of the 'README.md' file:

This exercise is about code refactoring, so we are providing you with a solution that already passes the tests.

The challenge is to rewrite it until you are proud of it, and learn something in the process.

If you don't know where to start, here are some ideas:

  • Try to reduce repetition to a minimum.
  • Try to make the code readable.

Take your time.

Change one thing at a time and check if your solution still passes the tests.

Have fun!

Unfortunately, it seems it is not in a very visible place, and sometimes people get confused about it, as already happened in #510.

This behavior was implemented in #301, to make things easier for the users. There where a lot of complains that the music generating exercises where boring, so we decided to provide working solutions, allowing users to save time and focus on the important part of the exercise: refactoring.

@lpil
Copy link
Member Author

lpil commented Jun 15, 2017

Seems quite confusing. Do other tracks do this?

@rbasso
Copy link
Contributor

rbasso commented Jun 15, 2017

Seems quite confusing. Do other tracks do this?

I don't think is so, but I didn't checked it.

It would be nice if we could make it more visible to avoid confusion, but the Hints section is the only place where we can put this information.

One of the main reasons to add these working solutions to refactoring exercises was that some people where simply doing a copy paste of the music, just to skip the exercise. We just made it easier!

Would you prefer that we didn't supply the working solution?

Edit: FYI, there are two other similar exercises that also have working stub solutions: house and food-chain.

@lpil
Copy link
Member Author

lpil commented Jun 15, 2017

I would prefer a non-working stub.

If someone wants to write a poor solution they will produce one.

If someone is interested in refactoring they are going to need a more complex stub file, the one given is just a string literal so can't really be refactored.

@rbasso
Copy link
Contributor

rbasso commented Jun 15, 2017

I would prefer a non-working stub.

If someone wants to write a poor solution they will produce one.

I'll mention the other @exercism/haskell maintainers. If they agree with that, we can certainly change the exercise.

If someone is interested in refactoring they are going to need a more complex stub file, the one given is just a string literal so can't really be refactored.

Why? (I did exactly that in my last iteration!)

@lpil
Copy link
Member Author

lpil commented Jun 15, 2017

Because there's not enough complexity for the refactoring to be interesting in any way. It's one step above an empty file :)

@rbasso
Copy link
Contributor

rbasso commented Jun 15, 2017

It's one step above an empty file :)

Exactly! 😄

@petertseng
Copy link
Member

petertseng commented Jun 15, 2017

Do other tracks do this?

All implementors of http://x.exercism.io/problems/tree-building and http://x.exercism.io/problems/ledger are likely doing this. I have not verified whether this statement is correct.

It is unlikely that any other implementors of the text generation exercises provide working solutions to students (disregarding the example obviously - not provided to students). I have not verified whether this statement is correct.

Unfortunately, it seems it is not in a very visible place, and sometimes people get confused about it,

I imagine this problem is common in tree-building and ledger too, then?

If someone is interested in refactoring they are going to need a more complex stub file, the one given is just a string literal so can't really be refactored.

I agree that many final products don't have much in common with the initial file. This might mean that students delete the string literal immediately. That is an available option. Other students may like ensuring that the solution still works at each step, and that is only possible if the solution works to start with.

It would be possible to make the initially-provided solution more complex than a string literal, but it's hard to predict whether it will resemble any student's desired final product.

No opinion is expressed on whether it's a good idea to make these exercises refactoring exercises.

No opinion is expressed on whether it's a good idea to provide the string literal.

@unmanbearpig
Copy link
Contributor

I was pleasantly surprised to find a working stub solution. That's what I was starting with in other languages, except that I had to make that huge string literal myself and make sure all the new lines and spaces are in the right places, which was a bit annoying. Having the most boring part of the exercise done for me is very nice.

@rbasso
Copy link
Contributor

rbasso commented Jun 16, 2017

I'm so glad to hear that, @unmanbearpig. 😄

@rbasso rbasso closed this as completed Jun 23, 2017
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

No branches or pull requests

4 participants