Skip to content
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

[v3] Template for Exercises #305

Open
cstby opened this issue Feb 15, 2020 · 4 comments
Open

[v3] Template for Exercises #305

cstby opened this issue Feb 15, 2020 · 4 comments

Comments

@cstby
Copy link
Contributor

cstby commented Feb 15, 2020

Rationale

As we write new concept exercises to v3, we can better set up learners for success by changing the exercise template.

Issue

Here is an example of the current template:

(defn armstrong? [num] ;; <- arglist goes here
  ;; your code goes here
)

This creates a few problems:

  • Many learners do not remove these comments before turning in their solution.
  • Learners get into the habit of writing functions without docstrings.
  • Learners are led to believe that the arglist should go on the same line as the function name. Many learners who later try to add docstrings will add them after the function arguments.

Suggestion

I propose the following changes:

  • Add a docstring below the function name. This accomplishes a few goals.
    1. Learners become aware of become aware of docstrings.
    2. The template is more representative of idiomatic Clojure.
    3. Learners are exposed to high-quality examples of how docstrings should be formatted and written.
  • Remove the single line comment referencing the function argument. Learners who get past the "function" concept will know that arguments are provided here.
  • Change "your code goes here" to be more descriptive. Something like "add function body here" or just "function body" more accurately describe what the learner needs to do.

The result woud look something like this:

(defn armstrong?
  "Returns true if `num` is an armstrong number."
  [num]
  ;; function body
  )
@cstby
Copy link
Contributor Author

cstby commented Feb 15, 2020

@porkostomus @bemself Forgot to tag your two when creating the issue!

@bemself
Copy link
Contributor

bemself commented Feb 16, 2020

@cstby Nice template! I like the docstring addition, I myself also forgot to add docstring in my example script for concept list, I will add it later. thanks a lot for pointing it out.

For other suggestions, I have only one concern, for a fresh starter, before he touches the function concept, he might not know [] is for arglist.

Remove the single line comment referencing the function argument. Learners who get past the "function" concept will know that arguments are provided here.

@bobbicodes
Copy link
Member

Totally agree! I always encourage students to prefer docstrings, for these reasons and with the additional benefit that then your library can be consumed by tools like cljdoc :)

@bobbicodes
Copy link
Member

Regarding the prerequisite of understanding basic syntax (like arglist), I'm sure that will be covered by a functions exercise, which will likewise depend upon vectors.

That's 2 more concepts right there - I'll go ahead and make issues for them while this is fresh in my mind.

@nicolechalmers nicolechalmers changed the title [Clojure] Template for Exercises [v3] Template for Exercises Jan 28, 2021
@nicolechalmers nicolechalmers transferred this issue from exercism/v3 Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants