ruby
ruby copied to clipboard
Create stubs for exercises.
Should we create stub files for exercises?
These would be empty or partially complete solution files.
For example the "hello-world" exercise requires that the hello_world.rb
file exists.
I think this would help people get started.
See https://github.com/exercism/discussions/issues/114 for a link to discussions other tracks have had about the question of stubs.
Any empty file that is required due to being required in the test file, I think that is suitable. Even better, with the BookKeeping module that is required for the exercises where the tests are generated, already written... Other than that, having the exercise started with a class or module or constant is not such a great idea... unless the exercise is more about performance, refactoring or something similar.
We (python – https://github.com/exercism/xpython/issues/272) are facing the same question. Did you come up with a solution in a different place than this issue?
I think this is current discussion, @behrtam.
I think we should add stub files. Some of the early ones can have useful starting templates setting up the classes and methods. The later ones can be empty.
I think this would be great - for the TwoFer exercise only. With a test added that shows that a file is present. For other exercises, knowing how to create a file, is part of the language fluency, and I don't think it should be present.
I know how to create files, creating one for every exercise is a meaningless chore that could be solved by adding the necessary file.
On a real project you also don't start with a pre-built test suite..
So perhaps explicitly not including the template on the third(?) problem and documenting that this is intentional would solve both our goals?
I think I like this idea. I saw it on the Elixir track and it gave me a bit more confidence on the initial exercises, which I appreciated 👍
For other exercises, knowing how to create a file, is part of the language fluency, and I don't think it should be present.
I understand this point though. I've had discussions around how classes are structured from people who were confused by the how tests were setup on TwoFer (thinking specifically about this submission).
I think it's useful to have a bit more hand-holding on the first exercises though. And if someone has questions about how tests are setup they can at least understand what we expect them to do on those initial exercises.
I'm a big fan of doing this everywhere. I think it just helps make things really clear and easy. The less need for any command-line interaction, the better. One thing to consider is that the hello-world tests that are walkthrough-y presume the file won't be created, so I don't know if we need to change that. (cc @kytrinyx).
I don't feel very strongly one way or the other.
One thing that came to mind as I read through this discussion, though:
I know how to create files, creating one for every exercise is a meaningless chore that could be solved by adding the necessary file.
One thing that I think is useful is understanding error messages. A lot of people see an error message that they'll likely see often in their career, and they don't understand what it means, and then they get stuck.
Widening this to the whole of exercism: https://github.com/exercism/exercism/issues/4789
I know how to create files, creating one for every exercise is a meaningless chore that could be solved by adding the necessary file.
To me, this was one of the key reasons why we introduced it. Creating a file is easy, and often tedious. I do agree that at some point we can expect people to know how to do this themselves. Note: does creating a file teach fluency?
Creating a file is no more teaching fluency than creating an array or list or hash or map or string. But it is part of knowing how to get around and feeling comfortable. I see a lot of programs in the wild that creates files, so yeah, I think it is part of it. Of course, you can choose to create files outside of that language, and then it teaches and promotes fluency in the environment in which you need files.
We're not talking about creating a file using Ruby though. Most people use "File->New" in their editor to achieve this. I'm not convinced this is part of fluency.
Sorry for the confusion @kotp, I was referring to the fact that creating a x.rb
file in the exercise's directory is not part of a language's fluency. The actual creation of a file using Ruby functions of course is.
No, but we are talking about creating a file for Ruby. Being able to take the communication that is given from Ruby, knowing that it is looking for a file that isn't there, identifying that it is either the wrong file that is being asked for or that the file needs to be created (or is unreadable, etc) is part of that skill that is needed. Being able to respond to that feedback without stumbling, is an indicator for fluency. (Though that fluency may extend below Ruby to the operating system).
I am for stub files early on, as a person new to the language, I don't really need to be pressed for learning to read the error messages for even getting started... but after I see the pattern of what is needed, I would hate to finish up here, and get stopped with an error message that I can't read because I did not see it before, when I had plenty of chances to learn that here.
I want to be able to get the fluency, the comfort, of knowing that I can encounter some errors, and know how to get through them, from a learning environment where I can be comfortable asking questions, than thinking I am comfortable and getting stopped with something as basic as that.
Early on I was quite adamant that people should have to create the file themselves at some point, and that is because I watched people do TDD and not understand the error message. The error message would pop up, their eyes would glaze over and they'd reflexively try to make it go away, without knowing exactly how.
Now I don't feel strongly about it. I feel like we have a much better understanding of what Exercism is for, and this does seem like make-work that gets in the way of that more than it helps.
Closing as solved. All exercises now have stub files.