Skip to content

Commit b704e68

Browse files
committed
Update documentation for practice exercise differences
1 parent 988132d commit b704e68

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed
Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
# Contributing to Practice Exercises
22

3-
## Adding a new Practice Exercise
3+
There are two types of practice exercises in the Java track.
4+
5+
- The most common are come from the [problem specifications repository][problem-specifications].
6+
The repository contains data that is common for all implementations, such as the introduction, instructions and the test cases.
7+
8+
- The others _do_ not have data in the problem specification and are specific to the Java track.
9+
10+
If you are looking to add a completely new exercise that is not from the [problem specifications repository][problem-specifications], please open a discussion in the forums in the [Java][forum-java] category for Java specific exercises or the [Building Exercism][forum-building-exercism] category for adding to the [problem specifications repository][problem-specifications].
411

5-
The easiest way to add a new exercise to the Java track is to port an exercise from another track.
6-
That means that you take an exercise that has already been implemented in another language, and you implement it in this track.
12+
If the exercise is already in the problem specifications, please check that no one else has claimed the issue or pull request.
13+
An issue can be "claimed" by asking (in a comment on the issue) if you can work on it.
714

8-
To add a completely new exercise you need to open a pull request to the [problem specifications repository][problem-specifications].
9-
Any completely new exercise needs to be added and accepted there before it can be added to the Java track.
15+
## Adding a new Practice Exercise
1016

11-
Before porting an exercise to the Java track, please review the [practice exercise guide][docs-building-exercises-practice].
17+
The easiest way to get started is to use [configlet] to provide the scaffolding.
1218

13-
Please make sure no one else has a pull request open to implement your chosen exercise before you start.
19+
```sh
20+
configlet create --practice-exercise <exercise-slug>
21+
```
1422

15-
It might also be a good idea to open a Pull Request to make it clear to others that you are working on this exercise.
16-
This can just be a Pull Request with an empty commit that states which new exercise you're working on.
17-
[Mark the Pull Request as Draft][github-draft-pr] to let the maintainers know that it's not ready for review yet.
23+
This will create the necessary entries in `config.json`, create the directory and pulls the exercise's document files from the problem specifications repository.
1824

1925
The Java specific details you need to know about adding an exercise are:
2026

21-
- Please add an entry to the `exercises` array in `config.json`.
27+
- Please check the entry added by configlet to the `exercises` array in `config.json`.
28+
The entries are sorted by difficulty, then name.
2229
You can find details about what should be in that entry at the [Exercism docs][docs-building-config-json].
2330
You can also look at other entries in `config.json` as examples and try to mimic them.
2431

@@ -30,11 +37,12 @@ The Java specific details you need to know about adding an exercise are:
3037
In the `resources/exercise-template` you will find a template to get you started.
3138
See [The Problem Submodules](../CONTRIBUTING.md#the-problem-submodules) section for details on how each exercise submodule is structured.
3239

33-
- Use the configlet to [generate documentation and metadata files][docs-building-configlet-sync-new-exercise] for the new exercise.
40+
- Please copy and add the Gradle files and directories from the `resources/exercise-template` directory.
41+
This should allow you to run Gradle from the exercise's directory.
3442

3543
- Make sure you've followed the [track policies](../POLICIES.md), especially the ones for exercise added/updated.
3644

37-
Hopefully that should be enough information to help you port an exercise to the Java track.
45+
Hopefully that should be enough information to help you add a practice exercise to the Java track.
3846
Feel free to open an issue or post in the [Building Exercism][forum-building-exercism] category of the [Exercism forum][forum] if you have any questions, and we'll try and answer as soon as we can.
3947

4048
## Updating the documentation for an exercise
@@ -48,8 +56,8 @@ bin/configlet sync --docs --metadata --update --exercise <exercise-slug>
4856

4957
## Updating the tests for an exercise
5058

51-
The tests for practice exercises are based on the canonical data in [problem specification][problem-specifications].
52-
Each practice exercise should contain a `.meta/tests.toml` file containing the test cases that were implemented for that exercise.
59+
For exercises from the [problem specification][problem-specifications], the tests are based on the canonical data.
60+
The practice exercise should contain a `.meta/tests.toml` file containing the test cases that were implemented for that exercise.
5361

5462
In case the canonical data for an exercise changes, this file can be updated by running the configlet from the root of this repository:
5563

@@ -60,10 +68,13 @@ bin/configlet sync --tests --update --exercise <exercise-slug>
6068
Note that this only updates the `.meta/tests.toml` file.
6169
Any tests that were added or updated should be implemented in the exercise's unit tests!
6270

71+
Syncing is _not_ required for Java specific exercises.
72+
6373
[docs-building-config-json]: https://exercism.org/docs/building/tracks/config-json
6474
[docs-building-configlet-sync-new-exercise]: https://exercism.org/docs/building/configlet/sync#h-using-sync-when-adding-a-new-exercise-to-a-track
6575
[docs-building-exercises-practice]: https://exercism.org/docs/building/tracks/practice-exercises
6676
[forum]: https://forum.exercism.org/
6777
[forum-building-exercism]: https://forum.exercism.org/c/exercism/building-exercism/125
78+
[forum-java]: https://forum.exercism.org/c/programming/java/91
6879
[github-draft-pr]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request
6980
[problem-specifications]: https://github.com/exercism/problem-specifications/tree/main/exercises

0 commit comments

Comments
 (0)