Scale Generator tests

I’m trying to sync the test suite for scale-generator on the Rust track. (link to problem spec tests)

It turns out that the Rust version has changed two test cases, namely the ones for chromatic scales. In the Rust exercise, the starting note is expected to be repeated at the end.

For example, consider the chromatic scale of “C”:

# rust
["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C"]
# problem spec
["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]

For the other tests, with the property “interval”, the problem spec tests also expects the last first note to be repeated at the end. Interestingly, this didn’t use to be the case, all the “interval” tests were reimplemented to add this last note. However, this was not done for the chromatic test cases.

Here is the commit that reimplemented all the “interval” tests (but not the “chromatic” tests).

I am completely clueless about music. I wonder: Why are the chromatic tests different than the interval tests? What is the right thing to do here? Should the chromatic tests be adjusted? Should I change the Rust tests?

At the risk of starting two unrelated discussions, every time I am confronted with this exercise, I think it should be deprecated. I already thought so when I was first solving it myself.

  • Every discussion I read about this exercise, almost everyone is confused about the musical theory and what should be the correct thing.
  • Users complain they don’t learn anything about music and just program against the test cases to make them pass.
  • If you strip the musical theory away (which people don’t understand and don’t care about), the implementation is terribly uninteresting. From a pure programming / problem-solving perspective, this exercise is boring busywork.

I am completely clueless about music. I wonder: Why are the chromatic tests different than the interval tests?

Chromatic always return a 12 notes scale because it represent the full range of the scale, aka every possible note is half step away from the other.
Think of intervals as how to represent that full range again but with different length of step in between (so it will often end up less than 12 notes), and since it is a full length travel it will always arrive at the starting note.

Think of it as traveling around the globe in a straight line (moving along the diameter), if you start from the north pole then your finished destination is also at the north pole.

I do agree about the problem being confusing for learners, I suspect it would be double whammy if english is not their main language.

1 Like

PR opened to deprecate the exercise: Deprecate `scale-generator` exercise by ErikSchierboom · Pull Request #2343 · exercism/problem-specifications · GitHub

2 Likes