java: Add missing stubs to exercises
The problem
Right now for some exercises, a student is required to read the tests to know which functions they should implement. This is annoying, time consuming and might discourage people from doing the exercise entirely. We should provide stubs for all exercises. Stubs should provide the signature of functions and classes, just so the student is immediately ready to start writing the custom logic. This is an example of a stub, from the Raindrops exercise:
class RaindropConverter {
String convert(int number) {
throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
}
}
All stubs must follow this format.
Contributing to this issue
This is a big issue that will require changes to a lot of exercises. The good news is that you don’t need to fix this is all exercises to contribute to this issue! PRs fixing this in just one exercise at a time or a couple of exercises at a time are more than welcome.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 34 (27 by maintainers)
Commits related to this issue
- #2133: Added UnsupportedOperationException for constructor and translate() method — committed to mnyon-grandkru/exercism-java by mnyon-grandkru a year ago
- #2133: Added Gradle explicit task dependency — committed to mnyon-grandkru/exercism-java by mnyon-grandkru a year ago
- added stub method (#2133) — committed to travis85904/exercism-java-fork by travis85904 a year ago
- added stub method (#2133) (#2326) — committed to exercism/java by travis85904 10 months ago
I went through the practice exercises and found two more exercises without stubs, opened PRs to add them. Once they are merged I believe this issue can be closed as completed!
The following still lack stubs:
I grepped for “Since this exercise has a difficulty of”
@PakkuDon I think they are all pretty much open 😃
It seems here in the Java track, all “medium” difficulty exercises or above don’t include stubs, so probably those are a good start, but there might be more. A quick
jqquery for exercises that are medium difficulty or above gives me this:jq query
There might be other exercises marked as easy that might not have stubs, so it might be worth to also double-check those.
About other tracks…I don’t know the state of stubs in other tracks other than the Go track, which has them. Also note the inclusion of stubs is something that each track can decide independently, some tracks might decide to not include them on purpose. If you are thinking on contributing a similar change to other tracks, please confirm the stance of each track on including stubs before proceeding.