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

README.md: update xgo style section #544

Merged
merged 1 commit into from
Mar 2, 2017

Conversation

robphoenix
Copy link
Contributor

After reading exercism/discussions#121 I
though it might be beneficial to add something to the README regarding
benchmarking on different machines. This led, as these things do, to a
small, opinionated rewrite of the xgo style section.

README.md Outdated
### Benchmarks

In most test files there will also be benchmark tests, for example in the
[clock exercise](https://github.com/exercism/xgo/blob/master/exercises/clock/clock_test.go#L75-L91).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we should add a Benchmark test to hello-world?

Copy link
Member

Choose a reason for hiding this comment

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

I think so, sort of along the lines of #515 how Hello World is the first exercise that explains how things work with Go and Exercism.

README.md Outdated
## Xgo style

Let's walk through the first problem in `config.json`, leap. Cd down into the leap directory now, there are two
Copy link
Member

Choose a reason for hiding this comment

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

ha, oops... only just realized this has been out of date since #206 - over a year. Better late than never.

README.md Outdated

We like errors in Go. It's not idiomatic Go to ignore invalid data or have undefined behavior. Sometimes our
Go tests require an error return where other language tracks don't.
Let's walk through the first exercise, *hello-world*. Navigate into the *hello-world*
Copy link
Member

Choose a reason for hiding this comment

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

Good use of navigate rather than Cd as a verb, which looked a bit weird.

README.md Outdated

### Tests

*hello_test.go* uses a data-driven test. Test cases are defined as data, then a
Copy link
Member

Choose a reason for hiding this comment

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

It's very hard to say whether this is true of hello_test.go since it only tests a single case (since the function always returns `Hello, World!". It's true that most exercises use this though. Perhaps we can explain about the other exercises perhaps?

README.md Outdated

In Go we generally have all tests enabled and do not ask the solver to edit the
test program, to enable progressive tests for example. `t.Fatalf`, as seen
in [*hello_test.go*](https://github.com/exercism/xgo/blob/master/exercises/hello-world/hello_test.go#L26),
Copy link
Member

Choose a reason for hiding this comment

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

careful - this line number may get out of date.

@petertseng
Copy link
Member

I like what's going on here, with the splitting into sections.

README.md Outdated
just bench the combined time to run over all the test data rather than attempt
precise timings on single function calls. They are useful if they let the solver
try a change and see a performance effect. It is important, though, to keep in
mind that benchmark tests are reflective of the machine they are run on. Benchmark
Copy link
Member

Choose a reason for hiding this comment

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

the section about being specific to the machine was well-placed in #545 since it is delivered with exercism fetch.

Do you see it serving a useful purpose here? I see this README file as helping out contributors to this track, and I feel a little uncertain how this will change their actions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, you're right. I wanted to include something somewhere, and started in the README, but then realised it would be beneficial in the track_hints file, and just left it here. The information is more for users than someone adding an exercise/test.

@robphoenix
Copy link
Contributor Author

I've rewritten parts of this after @petertseng's review comments. I decided to go back to using leap as the reference exercise as it's is more representative of the other exercises.

README.md Outdated
### Stub files

Stub files, such as `leap.go`, are a starting point for solutions. Not all exercises
need do this; this is most helpful in the early exercises for newcomers to Go.
Copy link
Contributor

Choose a reason for hiding this comment

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

need this or need to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, thanks.

README.md Outdated
directory and run `go run exercises/<problem>/example_gen.go`.

You should see that the `<problem>/test_cases.go` file has changed. Commit the change.
You should see that the `<problem>/test_cases.go` file has changed. Commit the
Copy link
Contributor

Choose a reason for hiding this comment

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

Change in this line might not be needed.

@robphoenix robphoenix merged commit 99d5792 into exercism:master Mar 2, 2017
@robphoenix robphoenix deleted the update/readme branch March 2, 2017 10:45
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