Well-defined input and output requirements in exercises

I’m not sure if it’s just because I’m new and can’t interpret things correctly, but it seems to me that the exercises lack a clear indication of how the inputs are structured, what kind of output is expected, and how the function is supposed to be named or called. I have to check the test cases every time to figure out this information on my own.
Marco

For practice exercises, that is deliberate. The instructions provide some context, but the tests are the detailed specification and you need to read them carefully. This is test-driven development in practice.

For tracks with a learning syllabus, I should note that the concept exercises are very different: simpler, with clearer specifications, and code samples that are similar to the tests.

1 Like

How the functions are named or called is given with the starter code, isn’t it?

That depends on the track and the exercise :slight_smile:

1 Like

for example, Conway’s Game of Life in Dart.
The only hint is the name of the class, the tests call a method, tick, and maybe another one, matrix. But matrix seems to be the input too.
I’m learning the language (otherwise i won’t do those exercises) and to figure out the forced structure the class has to have looking the test page or going for trials and errors seems to add an unecessary new layer of complexity

1 Like

Ah, I wrote that test suite. It seems a small readability tweak here would be to rename the matrix passed into the GameOfLife constructor. Would something like input or cells be helpful?

for sure. Then i have to change the way i approach exercism :)

1 Like

I have to come back with an example that explains why i’m getting mad :slight_smile:

Dart exercise “House”.
The instructions are the nursery rhyme — and nothing more.
Looking into the test file i see that the class is supposed to have a method named recite that takes two int(i guess?). But what do those integers mean? Who knows! I have to figure it out by induction, going through each test case and trying to understand how those two parameters relate to the rhyme?

I’m not a Dart maintainer so I’d defer to @glennj there. An option might be to add startVerse and endVerse variables to the test cases to better document what the ints represent.

@Coccosbrillo I appreciate you bringing your concerns here. As you can see, narrowing the discussion to particular exercises gives you the biggest return.

Regarding the House exercise, the instructions could use some more details. And the Dart test suite can be more verbose about the inputs are. The first is an issue for the problem-specifications repo so all tracks can benefit; the latter is Dart specific. @BNAndras that’s a great idea. Do you want to give me a PR?

1 Like

Should I PR this bit as well?

might as well

you guys are truly amazing

2 Likes