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

Go: Specifications confusing #2746

Closed
cjbottaro opened this issue Feb 2, 2016 · 5 comments
Closed

Go: Specifications confusing #2746

cjbottaro opened this issue Feb 2, 2016 · 5 comments

Comments

@cjbottaro
Copy link

Hello. I'm doing the Go track and I find the specifications in the readme very confusing. Take hello-world for example...

First off all, we're not writing a program (there is no main function), we just writing a function (the readme instructs to write a program).

Second, if we're writing a function, the specification should be described in terms of input and output (and maybe side effects). Using words like "greets", "says" and "saying" implies printing (presumably to STDOUT). Using phrases like "If I tell the program..." implies that we're writing a program with command line args (argv).

Looking at the tests reveal this is absolutely not the case. We're writing a function which takes a string as input and returns a string. It would be much more clear, IMO, if the specification was written like:

Write a function named HelloWorld which takes a single string as input.
If the string is empty (""), the function should return "Hello, World!".
If the string is non-empty, the function should return a greeting:  "Hello, <string>!".

Thank you.

@kytrinyx
Copy link
Member

kytrinyx commented Feb 2, 2016

I find the specifications in the readme very confusing [...].

Yeah, that's fair. We try to make the README generic, since the same description is used for all of the languages.

We can't say "write a function" (some languages have methods not functions) and we can't specify inputs and outputs (implementations vary between languages). The test suite is the specification.

I'll see what I can do to clarify.

@cjbottaro
Copy link
Author

Ahh, I thought the readme was specific to each language. Interesting. So that means all the exercises are the same across the all languages? That seems difficult to be able to teach idiomatic code.

Take for example an exercise where the user is to create an in-memory cache. Languages without closures would probably just have an API with cache.read and cache.write. But languages with closures (like Ruby), you could have a cache.fetch:

cache.fetch(key){ generate_value } # block is only called if key doesn't exist

But this idea doesn't translate well to, say, Python because Python doesn't have anonymous functions (lambdas only allow expressions).

Anyway, just some ideas. :)

@kytrinyx
Copy link
Member

kytrinyx commented Feb 2, 2016

So that means all the exercises are the same across the all languages?

Ish :) Language tracks will skip exercises that don't make sense in that language. Here's the full list of problems and which languages implement them: http://x.exercism.io/problems

@Insti
Copy link

Insti commented Aug 3, 2016

Languages can add their own specific comments to the Readme using a HINTS.md file.

@Insti Insti changed the title Specifications confusing Go: Specifications confusing Aug 3, 2016
@kytrinyx
Copy link
Member

kytrinyx commented Aug 5, 2016

I'm going to close this in favor of the one that @Insti kindly opened a new one in the Go track. (Thanks @Insti!)

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