Skip to content

Commit b4a8b9f

Browse files
kahgohjagdish-15
andauthored
Update documentation for practice exercise differences (#3012)
Co-authored-by: Jagdish Prajapati <[email protected]>
1 parent 489bc89 commit b4a8b9f

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed
Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
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.
47

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.
8+
- The others _do_ not have data in the problem specification and are specific to the Java track.
79

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.
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].
1011

11-
Before porting an exercise to the Java track, please review the [practice exercise guide][docs-building-exercises-practice].
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.
1214

13-
Please make sure no one else has a pull request open to implement your chosen exercise before you start.
15+
## Adding a new Practice Exercise
1416

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.
17+
Before adding an exercise to the Java track, please review the [practice exercise guide][docs-building-exercises-practice].
18+
19+
The easiest way to get started is to use [configlet][docs-configlet] to provide some of the scaffolding.
20+
21+
```sh
22+
configlet create --practice-exercise <exercise-slug>
23+
```
24+
25+
This will create the necessary entries in `config.json`, create the directory and pulls the exercise's document files from the problem specifications repository.
1826

1927
The Java specific details you need to know about adding an exercise are:
2028

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

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

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

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

37-
Hopefully that should be enough information to help you port an exercise to the Java track.
47+
Hopefully that should be enough information to help you add a practice exercise to the Java track.
3848
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.
3949

4050
## Updating the documentation for an exercise
@@ -48,8 +58,8 @@ bin/configlet sync --docs --metadata --update --exercise <exercise-slug>
4858

4959
## Updating the tests for an exercise
5060

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.
61+
For exercises from the [problem specification][problem-specifications], the tests are based on the canonical data.
62+
The practice exercise should contain a `.meta/tests.toml` file containing the test cases that were implemented for that exercise.
5363

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

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

73+
Syncing is _not_ required for Java specific exercises.
74+
6375
[docs-building-config-json]: https://exercism.org/docs/building/tracks/config-json
64-
[docs-building-configlet-sync-new-exercise]: https://exercism.org/docs/building/configlet/sync#h-using-sync-when-adding-a-new-exercise-to-a-track
6576
[docs-building-exercises-practice]: https://exercism.org/docs/building/tracks/practice-exercises
77+
[docs-configlet]: https://exercism.org/docs/building/configlet
6678
[forum]: https://forum.exercism.org/
6779
[forum-building-exercism]: https://forum.exercism.org/c/exercism/building-exercism/125
68-
[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
80+
[forum-java]: https://forum.exercism.org/c/programming/java/91
6981
[problem-specifications]: https://github.com/exercism/problem-specifications/tree/main/exercises

0 commit comments

Comments
 (0)