-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document practice exercise files #36
Conversation
- `.docs/hints.md`: provide hints to a student to help them get themselves unstuck in an exercise. | ||
- `.meta/config.json`: contains meta information on the exercise. | ||
- `.meta/design.md`: describe the design of the exercise. | ||
- `.docs/introduction.md`: introduce the concept(s) that the exercise teaches to the student (required) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now made it explicit per file if the file is required or optional
- Documentation files: presented to the student to help explain the exercise | ||
- Metadata files: not presented to the student, but used to define metadata of the exercise | ||
- Exercise files: the language-specific files, like the implementation and test files | ||
### Documentation files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introducing these headings allows linking to a specific type of file.
- Test suite: verify a solution's correctness (required) | ||
- Stub implementation: provide a starting point for students (required) | ||
- Exemplar implementation: provide an idiomatic implementation that passes all the tests (required) | ||
- Additional files: ensure that the tests can run (optional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These files were missing from the list
@@ -74,6 +80,8 @@ exercises | |||
|
|||
**Purpose:** Introduce the concept(s) that the exercise teaches to the student. | |||
|
|||
**Presence:** Required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added this field to make it explicit if the field is required without having to consider any of the other text in this document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great decision.
### File: .docs/source.md (required if there are third-party sources) | ||
|
||
**Purpose:** Describe the third-party source(s) of the exercise. | ||
|
||
This file contains third-party references and sources of the exercise. Only required if there are any such sources, but not if the exercise was completely designed from scratch for Exercism. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file will be replaced by two new fields in the .meta/config.json
file. There were only a couple of usages of this file, so migrating should not be an issue.
- `source`: The source this exercise is based on (optional) | ||
- `source_url`: The URL of the source this exercise is based on (optional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the new fields to describe the source of an exercise. They match the names used in prob-specs metadata: https://github.com/exercism/problem-specifications/blob/main/exercises/zebra-puzzle/metadata.yml
- Design the stub such that a student will know where to add code. | ||
- Define stubs for any syntax that is not introduced in the exercise. For most exercises, this means defining stub function/methods. | ||
- For compiled languages, consider having compilable code, as compiler messages can sometimes be hard to grasp for students new to the language. | ||
- The code should be as simple as possible. | ||
- Only use language features introduced by the exercise or its prerequisites (and their prerequisites, and so on). | ||
- The stub file is shown to the student when doing in-browser coding and is downloaded to the student's file system when using the CLI. | ||
- The relative paths to the stub implementation file(s) must be specified in the [`.meta/config.json` file's `"files.solution"` key](./#filemetaconfigjson). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This refers back to the new files
key in the .meta/config.json
file.
These files are _not_ presented to the student, but used to define metadata of the exercise. | ||
|
||
- `.meta/config.json`: contains meta information on the exercise (required) | ||
- `.meta/design.md`: describe the design of the exercise (optional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this for consistency with concept exercises and because it can be used to document certain design decisions.
@@ -0,0 +1,193 @@ | |||
_work in progress_ | |||
|
|||
# Presentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal of this document is to help explain how documents end up being presented to the student.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll need a clearer name for this, but I can't think of one off hand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is display or student_display any clearer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna merge this PR and we can come up with a better name later.
Co-authored-by: Jeremy Walker <jez.walker@gmail.com>
Love it! Syncing the README has been a continuous pain point for new contributors to Rust.
It's not clear to me what benefit there is in requiring synchronization for these files. Obviously for exercises which do not exist in the problem specifications, we need to provide exercise-specific files, but for exercises which should stay synced with the specifications, I feel that a rule like "Omitting these files will cause the website renderer to automatically fetch the appropriate one from the
Really not a fan of this being mandatory; it feels a lot like busywork, especially when backfilling large numbers of practice exercises.
|
|
||
This file contains meta information on the exercise: | ||
|
||
- `authors`: The exercise's author(s) (required) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I beg you not to do this for practice exercises 😭 we would need to go through git history for 100 exercises to figure out for each who authored them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. How about we make it optional. I do want it there so people can have that credit, but the work involved to go back through old exercises does feel prohibitive for it being required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I beg you not to do this for practice exercises 😭 we would need to go through git history for 100 exercises to figure out for each who authored them.
It sounds like I should be able to do this via a script, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. How would you do it? Would you choose a single file from an exercise and find the author of the commit that adds that file? Which file would it be? Would it be guaranteed to detect renaming and moving the file around? We changed all the paths in all the exercises once when migrating from Elixir scripts to mix projects. I need to use my IDE's git plugin to correctly track changes to a file, GitHub for example doesn't understand moving files 🙄. And would that really mean that is the real author of the exercise?
Let's take queen-attack
for example. This is the commit where it was authored by dalexj: exercism/elixir@5648c33 None of the files exists anymore under the same path as they were created. And its README seems to have been created later, by Katrina exercism/elixir@400cfe5 When you ask GitHub for the history of the file directory, it only shows the v3 big bang commit: https://github.com/exercism/elixir/commits/fb333fcb94501082b0d174c949d85bc15bfdbc5c/exercises/practice/queen-attack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think we must do this via a script. There are so many practice exercises implemented and it would be fantastic to attribute them to users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@angelikatyborska That is due to GitHub not using the --follow
command for the log. See the following console output for the log of the exercises/practice/wordy/README.md
file in the Elixir repo.
Without --follow:
erik@VELPIE:~/elixir$ git log exercises/practice/wordy/README.md
commit fb333fcb94501082b0d174c949d85bc15bfdbc5c
Author: Erik Schierboom <erik_schierboom@hotmail.com>
Date: Fri Jan 29 14:37:47 2021 +0100
[v3] Move existing exercises to exercises/practice
With --follow:
commit fb333fcb94501082b0d174c949d85bc15bfdbc5c
Author: Erik Schierboom <erik_schierboom@hotmail.com>
Date: Fri Jan 29 14:37:47 2021 +0100
[v3] Move existing exercises to exercises/practice
commit 7de06dd889c4be1f0bb47f2cadf723ad38e7a201
Author: Cohen Carlisle <cohencarlisle+github@pm.me>
Date: Sun Jul 28 20:43:09 2019 -0400
fix old test docs in readmes
commit 432813834b2c09a4a2ed8cf31d36a77b3e3f9ba1
Author: Devon Estes <devon.c.estes@gmail.com>
Date: Wed Aug 15 11:34:36 2018 +0200
Run configlet to update READMEs of exercises
....
The fundamental reason is that track repos are "live", whereas problem-specs is not. When a track repo is updated the website syncs it immediately. It is effectively automatically deployed. Problem-specs is instead a reference repo. Tracks may be out of date with it (in fact, most tracks are out of date with prob-specs). Further, it is important that tracks have the ability to keep their content out of sync with problem-specs until they deliberately choose to update, else their tests etc might become out of sync with the docs in problem-specs. I think it is also harder to work on an Exercise in a language if some of the files that comprise it live in another repo. Having to have problem-specs open next to it seems to be to be a harder and more complicated way of doing things, than using CI to copy things to the right places, but I appreciate that maybe this is a preference rather than a solid rule.
Understood. We do need it for the For existing tracks/exercises we should be able to automatically script this, and I know that Julia has already added the automatic generation of this file to their Concept Exercises based off centralised track-data via CI, so a similar thing might be possible for Practice Exercises in general moving forward. (e.g. You could have a regexp pattern that you run your exercise against to determine the correct values for the files). |
Co-authored-by: Jeremy Walker <jez.walker@gmail.com>
Co-authored-by: Jeremy Walker <jez.walker@gmail.com>
In this PR, we're documenting the documents that make up a practice exercise. The old v2 style of practice exercise documents will be replaced with a newer style that closely mimics the concept exercises structure. These changes will allow us to deliver a customised experienced to the user depending on whether they are using the CLI or the Online Editor. Here is a short summary of the changes:
README.md
document of practice exercises will be removed. It will be replaced with a.meta/instructions.md
document, with optional.meta/introduction.md
and.meta/hints.md
documents..docs/hints.md
document, but only general hints (we don't have tasks for practice exercises).description.md
document of Problem Specification exercises will be removed. It will be replaced with aninstructions.md
document, and optionally anintroduction.md
document. The goal here is to separate the introduction from the instructions, which can help in adding language-specific additions (more on that later)..meta/instructions.md
and (optional).meta/introduction.md
documents of a practice exercise should be direct copies of the corresponding Problem Specifications exercise's files.configlet
will support automatically syncing the contents of these files..meta/hints.md
document will be replaced by.docs/instructions.append.md
and/or.docs/introduction.append.md
. The contents of these files will automatically be appended to the instructions and/or introduction..meta/config.json
file, which is almost identical to the concept exercise version, except for theforked_from
property which does not apply to practice exercises..meta/config.json
files will have two new, optional properties:source
andsource_url
. These replace the existingsource.md
document for concept exercises (which was only used a couple of times). For practice exercises, configlet will automatically sync these values to the values defined in the practice exercise'smetadata.yml
file.exercises/shared/docs
directory will have three files:debug.md
(explaining the in-browser "debug: options),help.md
(track-specific help information, like a link to a gitter channel) andtests.md
(how to run the tests)..docs
directory (this should be an exceptional use case).cli.md
(how to use the CLI) andhelp.md
(for Exercism-specific help instructions).meta
directory.I've documented the practice exercise files, added documentation on the shared files (both track- and Exercism-specific) and added a document showing how the various files all interact and what the end result is (WIP).