Skip to content
This repository has been archived by the owner on Mar 18, 2021. It is now read-only.

Add exercises for each example #60

Open
milesfrain opened this issue Dec 11, 2019 · 7 comments
Open

Add exercises for each example #60

milesfrain opened this issue Dec 11, 2019 · 7 comments

Comments

@milesfrain
Copy link
Contributor

How do you feel about adding a section with one or more exercises to each example?
I'm happy to contribute exercises as I work through each section.

It may also be helpful to have exercise solutions. To include those, should I just shift the numbering prefixes?

src/01-Static-HTML/01-Static-HTML.md
src/01-Static-HTML/02-Static-HTML.purs
src/01-Static-HTML/03-Static-HTML-solutions.purs  <--- New file
src/01-Static-HTML/04-Adding-Properties.md
etc.
@JordanMartinez
Copy link
Owner

I'm fine with adding exercises to this repo and their recommended solutions. There's a few concerns to keep in mind:

  • not everyone will want to do the exercises. Sometimes, they just want to play with the examples I currently have. If the exercises are stored in the same folder and aren't filled out, they will cause compilation errors that stop that.
  • assuming the exercises and solutions become out-of-date due to a breaking change, I think it'll be easier to update the documentation than the code exercises and solutions as that could become a lot to maintain. So, I'd like to keep the 'tutorial' and 'exercises' parts of this repo separate.

So, perhaps this is the route we should take?

  • all exercises / solutions files should go in a separate folder at the same level as src (e.g. exercises)
  • update the project's ReadMe to include the comment about exercises being included
  • update each section's ReadMe to indicate where the section's corresponding exercises and solutions are
  • I'd have to update the ToC generator script to include that extra folder
  • each exercise and solution abides by the following format

Exercise / Solution Format

src/ -- folder for storing normal tutorial stuff
exercises/ -- folder for storing exercises
  section/ -- name corresponds to section it covers
    exercise-name/
      problem.purs
      solution.purs
      ReadMe.md -- overviews the problem and the goal the learner has

Thoughts?

@milesfrain
Copy link
Contributor Author

The exercises will certainly be opt-in for readers of the guide.
I'm envisioning that the exercises will only be suggested things to add to each example, so there's no risk of incomplete exercises failing to compile.
The additional maintenance burden is a major concern. So now I'm thinking that it may be best to track the solutions as a separate branch, where the changes are made directly to the existing example files. (See sample exercises and solutions-branch).

Pros and Cons of the solutions-as-branch strategy are:

Pros:

  • No file duplication.
  • Broken or out-of-date exercise solutions will not break the mainline build.
  • Updates to examples might not even affect the exercises, and for those situations, the solutions branch may simply be rebased onto the latest release.
  • The code changes required for each solution are most easily viewed as a diff.

Cons:

  • History of solutions for older releases may be lost upon rebasing.

@JordanMartinez
Copy link
Owner

I'm against the solutions-as-a-branch strategy.

I like the "suggestions of what to add to a pre-existing example as an exercise" idea.

@milesfrain
Copy link
Contributor Author

How about we just stick to the "suggested additions" approach for now, since that only involves a small change to each readme, and closely matches the solution-less strategy of the official purescript book.

A decision on if and where to track solutions can be made later, with no solutions being the choice for now.

One solution-management possibility is to encourage readers to fork this repo and fill in their own solutions. When all of their solutions are complete, they could add an entry to a readme table in this repo that points to their fork along with the release tag that their solutions were made against.

@JordanMartinez
Copy link
Owner

That sounds good to me!

@milesfrain
Copy link
Contributor Author

Progress update: Here are some exercises along with solutions for sections 01/01 - 02/05. Future additions will be applied to those branches.
Will file a PR once all the exercises are complete.

@JordanMartinez
Copy link
Owner

Nice!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants