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

Add hello-world exercise #475

Merged
merged 1 commit into from
Feb 20, 2017
Merged

Add hello-world exercise #475

merged 1 commit into from
Feb 20, 2017

Conversation

ErikSchierboom
Copy link
Member

This PR adds the hello-world exercise, as requested in https://github.com/exercism/todo/issues/34.

This is my first PR in this language track, so I hope everything is in order. Let me know if it isn't.

@petertseng
Copy link
Member

Don't forget to add to config.json.

The questions below assume hello world is intended to be the first exercise:

I have slight unease with introducing Maybe on the very first exercise: exercism/problem-specifications#290 (comment)

Looking at Learn You a Haskell, the first-ever mention of Maybe is at http://learnyouahaskell.com/modules, the 7th chapter out of 14.

Then again, we also introduce Maybe relatively early: in exercise rna-transcription, Maybe appears.

Maybe I'm underestimating the audience's ability to understand Maybe, and maybe it'll all be fine to include Maybe in the first exercise. If anyone has evidence to support one side or the other, please help by sharing it.

@ErikSchierboom
Copy link
Member Author

@petertseng I can only agree, it's just that hello-world is supposed to be the first exercise. There was a discussion somewhere on this. @kytrinyx?

@petertseng
Copy link
Member

petertseng commented Jan 29, 2017

Maybe I need to look at exercism/problem-specifications#290 again. I want to know what the purpose of this first exercise should be.

  1. Should it be just an introduction to Exercism, to demonstrate to a student how to fetch and submit? In that case, it's language-agnostic, and doesn't belong in any specific track.
  2. Should it be an introduction to the language track, to demonstrate to a student how to run the testing framework for the language? In that case, maybe it's best if the function-under-test has as little logic in it as possible. I'm thinking a the-answer exercise that asks the function to do nothing more than return 42, unconditionally.
    • sub-question: How much experience with the language is assumed by the time the student gets to this first exercise? The concern of "Don't introduce Maybe in first exercise" is not relevant if we assume the student has some level of knowledge similar to "has read Learn You A Haskell at least through the first seven chapters".

@petertseng
Copy link
Member

I can only agree, it's just that hello-world is supposed to be the first exercise.

Hmm... given that I have your agreement too, I am very inclined to reject the supposition entirely. Or if hello-world is being hard-required on all tracks (I note that I see no such initiative), I would highly suggest that at least this track make it "Hello, world!" unconditionally.

Of course, that's in contravention of the README, so now we have another problem to deal with. I wonder if we can stick something in HINTS.md that says something to the effect of "ha ha, ignore what it says above", but that's clumsy and indicates disharmony in the world.

Or another possibility is to go campaign to all tracks that unconditional "Hello, world!" is the right thing to do. And then all of them have to change their tests because otherwise they're in contravention of a hypothetical README that says it's unconditional "Hello, world!". I'm slightly disinclined to be the one who spends time embarking on this campaign.

All this above is why I suspect the-answer may be the answer, so we don't have hello-world in an inconsistent state with some tracks doing it one way and some tracks another.

I want to know what the purpose of this first exercise should be.

These suggest that it's a combination of all of these: intro-to-exercism, intro-to-track, intro-to-tdd.

Argh, this puts a hole into the the-answer idea. Since there is only one test in the-answer, there is only one "failing test -> passing test" transition, which isn't necessarily enough to show TDD.

@ErikSchierboom
Copy link
Member Author

I would also have thought that the-answer would be the correct answer.

@kytrinyx
Copy link
Member

My original idea for hello world was to give a very easy exercise to make sure that the person gets everything wired together. The secondary goal is to introduce people to how to run the test suite in a given language.

I don't see any particular reason to require each track to have a hello world exercise, and certainly not with any particular implementation. Especially where the implementation introduces concepts that make it frustrating to get started.

@petertseng
Copy link
Member

There is one potential implementation I can offer that is faithful to the README and does not introduce Maybe:

Use the same technique from sum-of-multiples (remember #100?):

helloDefault :: String
helloDefault = error "You need to implement this"

hello :: String -> String
hello = error "You need to implement this"

If that is deemed usable, we could go with it.

  • One could say that the Default is a bit suspicious-looking (would someone actually do that in real Haskell?)
  • hello-world could be a place where we provide copious comments that explain everything that goes on - is any of that not served by our existing documents, including exercises/TRACK_HINTS.md, docs/TESTS.md, docs/INSTALLATION.md? Any chance it can fit in leap instead?

@kytrinyx
Copy link
Member

We could also considering making the README simpler and more—uhm—flexible.

petertseng added a commit that referenced this pull request Jan 30, 2017
While evaluating that a proposed hello-world exercise in #475 would
introduce Maybe into the track at the first exercise, I found myself
wondering what other exercises introduce Maybe. I decided to put this,
and select other topics, into the config.json file.

The topics selected are, largely, those that might affect a problem
ordering decision. They are topics that either require some effort to
grasp (so we should not put them too early) and/or are repetitive (so we
should not place them too close together).

* Maybe
* Either
* Lazy evaluation
* Define a data type
* Library reimplementation
* Refactoring
* Accumulator-strictness
* instance TC (where TC is any typeclass other than Eq or Show)
* IO Monad
  * Random
  * Mutable state

Closes #274.
@petertseng
Copy link
Member

I can try to do that, but I'm having a real hard. Currently I'm complaining that it's overspecified. But if I go too far in the other direction and make it underspecified, that's no good either. I'll make my case anyway, since there's no harm in asking.

@rbasso
Copy link
Contributor

rbasso commented Jan 30, 2017

It seems I'm a little late, but I'll try to summarize my thoughts about it:

About the implementation

The implementation seems perfect, @ErikSchierboom, but I'm also not comfortable with a Maybe in the first exercise.

About the hello-world exercise

I like the idea of a introductory exercise, but I think thathello-world misses the point when it tries to include an optional argument. To be faithful to the "Hello, World!" spirit, I think that it should be as simple as possible:

hello :: String

But as @petertseng already pointed out, this would be against what is specified in x-common.

Also, the description.md says a lot about TTD, which is great, but not exactly the best match for Haskell, as its static, strongly-typed system pushes a Type-Driven Development - where tests are still relevant, of course, but probably not as in dynamic languages.

@ErikSchierboom
Copy link
Member Author

My personal preference would be to simply the README of the hello-world exercise. I do think there is real value in a starting exercise that only requires you to simply return the "Hello, World!" string. As the implementation thus becomes trivial (which it isn't with optional values), it allows people to focus on the other things:

  1. Figuring out how to write an implementation
  2. Running the tests
  3. Submitting the exercise

The hello-world exercise thus becomes just an introduction to the track's infrastructure. If one would then use leap as the second exercise, that would introduce a second aspect: creating an implementation by using multiple tests.

I think the main disdvantage of simplifying the hello-world exercise is that all tracks already implementing this exercise should also do this. I do think it's worth it though.

@rbasso rbasso added the on hold label Feb 1, 2017
@kytrinyx
Copy link
Member

kytrinyx commented Feb 3, 2017

I think this discussion is important enough that we should promote it to the discussions repository. If we can get some sort of consensus we can draft an issue that can be submitted to all the tracks that have a hello-world currently.

@petertseng
Copy link
Member

petertseng commented Feb 4, 2017

I think this discussion is important enough that we should promote it to the discussions repository.

Indeed, such a discussion is at exercism/problem-specifications#520 (Sorry, I chose the x-common repository instead of the discussion repository).

I was hoping that you personally did not have any objection to it, because this is one case where curriculum matters and user experience are pretty inter-related. I will take the fact that you haven't immediately objected indignantly as one half of a good sign (the other half would be explicit agreement because implicit non-disagreement is not the same as explicit agreement)

@rbasso rbasso removed the on hold label Feb 18, 2017
@rbasso
Copy link
Contributor

rbasso commented Feb 18, 2017

Considering that exercism/problem-specifications#520 is going to be merged soon, I think there is no reason to keep this PR on hold anymore.

@ErikSchierboom
Copy link
Member Author

So I should update this PR to do the simple "Only return the 'Hello, World!'" string version, right?

@rbasso
Copy link
Contributor

rbasso commented Feb 19, 2017

That would be great!

So I should update this PR to do the simple "Only return the 'Hello, World!'" string version, right?

@ErikSchierboom
Copy link
Member Author

I've just updated the PR. The updated exercise is very simple and a good first exercise now I guess.

Copy link
Contributor

@rbasso rbasso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems great!

module HelloWorld (hello) where

hello :: String
hello = "Hello, World!"
Copy link
Contributor

@rbasso rbasso Feb 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry a little that maybe this way the student will be able to pass the tests without finding the source file that needs to be changed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand. Isn't this (putting the sample in an examples directory) the way other exercises also work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh...sorry! It is perfect. I just confused the files. 👍

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

Successfully merging this pull request may close these issues.

4 participants