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

Create module files for exercises that already have the test file and module linked #76

Closed
trosel opened this issue Jan 18, 2017 · 11 comments
Milestone

Comments

@trosel
Copy link

trosel commented Jan 18, 2017

All other languages I've used on Exercism include a readme, a test file, and a module that has the boilerplate code sketched out for you.

In order to make these ultra beginner friendly, the module files should be included.

As-is, a beginner like myself would have to go through a whole tutorial on how .t files work and how the module system works in order to just work on a challenge.

@kotp
Copy link
Member

kotp commented Jan 19, 2017

@WildYorkies would it be sufficient to do this for the first 2 or maybe 5 exercises, and assume after that, the "pattern" has been established?

@trosel
Copy link
Author

trosel commented Jan 19, 2017

@kotp I think that would be fine, indeed. Do you think the file should start as a class? Or could it start as a module itself? If you use classes, you'd be forcing people into an OOP style of solution, I suppose.

You'd want the file to show best practices at least. For example, for the Bob one, I guess you'd put something like the following in the exercise file

use v6;

class Bob {
  method hey(Str input --> Str response) {

  }
}

I think the key thing, though, is that the exercise file and the test file are already linked. So the user only needs to run the test file.

@kotp
Copy link
Member

kotp commented Jan 20, 2017

There is a lot of suggestions in what you are stating. I think this can be simplified in providing a "Hello World" exercise as the first exercise, and then the "good parts" are delivered and information relayed before getting hit with something as complex as the Bob exercise.

I have heard you... and I am moving this up on my todo list.

@m-dango
Copy link
Member

m-dango commented Jan 23, 2017

@WildYorkies Thanks for the input. Having some boilerplate for a few of the initial exercises is something I'd like to see and plan to include. I've been either busy or away from home from the new year until now, but intend to continue making improvements to this repo where I can.

@m-dango
Copy link
Member

m-dango commented Feb 1, 2017

I've created a PR for the hello-world exercise. It includes a stub file and I believe it should be straight-forward enough for a first exercise. There are also some optional tests, marked as 'TODO', if the person doing the exercise wishes to add a little more complexity.

PR is here: #78

I'd prefer to have exercises with both modules and classes for some variation. I think when I first came to this repo most if not all exercises were classes!

I also plan to shuffle the order of the first few existing exercises, add more stubs, and perhaps make a few changes.

@trosel
Copy link
Author

trosel commented Feb 1, 2017

@mienaikage Agreed. I think it's silly to make a classes for many of these.

Perhaps the default file that we include should be a module. Then the user can optionally define a class within if they prefer?

For example, if the challenge is to assign flowers in a garden to each student in a class, we should probably just have a module. Because the user can then choose to represent the garden/flower/student as an object or they can choose to represent them as simple Maps.

@m-dango
Copy link
Member

m-dango commented Feb 1, 2017

It sounds like a good idea, but it could make writing tests for these exercises trickier. I might investigate what the tests would need to accommodate for doing it both ways.

@trosel
Copy link
Author

trosel commented Feb 1, 2017

@mienaikage What if the only thing you required in the solution was a MAIN.

That way, all of the tests would just be done by passing various arguments to MAIN. Beyond that, the learner could use any abstraction they wanted.

And at the same time, they'd be able to iteratively test their script from the command line as they go just by calling their own script. Then they can call the test file to make sure everything is completed.

@m-dango
Copy link
Member

m-dango commented Feb 2, 2017

I'm not too familiar with MAIN, but it could be worth giving it a go in one or two exercises and seeing how well it works.

@trosel
Copy link
Author

trosel commented Mar 4, 2017

@mienaikage I like what you've done so far. I think you can merge them all.

I'd like to see comments in the first exercises test file that explains what everything in that file is for, but I can submit a PR for that after you merge.

@m-dango m-dango modified the milestone: launch Mar 23, 2017
@m-dango
Copy link
Member

m-dango commented Mar 23, 2017

I've merged a few and added some more PRs. All available exercises should have module files included now (with at least a unit class/module line included).

Also updated a whole bunch to use the most recent tests from x-common canonical data.

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