Skip to content

Improves Hello-World#279

Merged
arcuru merged 4 commits intoexercism:masterfrom
arcuru:hw_improve
Aug 3, 2019
Merged

Improves Hello-World#279
arcuru merged 4 commits intoexercism:masterfrom
arcuru:hw_improve

Conversation

@arcuru
Copy link
Copy Markdown
Contributor

@arcuru arcuru commented Apr 27, 2019

Closes #273

This adds lots of comments and a compilable example for the hello world exercise. It also adds a CI test to validate that assertion.

@elyashiv
Copy link
Copy Markdown
Contributor

I wander - are we teaching c++ from ground up, or are we improving the coding of someone that's learning c++ in some other manner? Some of the comments are very verbose - I hope I don't need to explain what's using, or that the implementation and declaration are separate... What do we expect the student to know already?

@arcuru
Copy link
Copy Markdown
Contributor Author

arcuru commented Apr 27, 2019

The vast majority of people using Exercism track seem to already be somewhat proficient in the language already. The changes here are not really for them, and they should know that. We don't even mentor the Hello World exercise AFAIK, because the point is just to demonstrate how the track works.

Many people use it as a starting point to learn a new language though, and for those people the hello world exercise demonstrates how exercises are structured and some basics of the language. I've been overly verbose in the vein of https://learnxinyminutes.com/docs/c++/ so they can learn what features of the language you really have to know to understand the problems.

Mostly though, this change is meant to improve the on-ramp for people who are entirely new to the language. The goal is to get something that compiles, so they know when they've set it up correctly, and to demonstrate how the problems are structured. There are a number of people who benefit from that. I'm pretty sure most of the issues that students open in this repo are just about setting up Hello World.

(Actually, I should really change the failing "Hello!" to "Change me!" or something to make the error messages clear.)

Other tracks have actually spent time ordering their exercises in a way that introduces new concepts in the language logically, so they're actually better for learning the language from scratch. There are some higher level efforts in that area too - see https://exercism.io/blog/track-anatomy-project

Comment thread exercises/hello-world/hello_world.cpp Outdated
Comment thread exercises/hello-world/hello_world.cpp Outdated

// Use everything from the 'std' namespace.
// This lets us write 'string' instead of 'std::string'.
using namespace std;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is that really a good idea? This is actually suggesting to use using namespace std; all the time. Not a good coding style

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

People tend to disagree on this point - See CppCoreGuidelines and Google.

It's generally safe to use in a small, self-contained source file, though there are potential issues in large codebases. It is one of those conveniences that I see as being very helpful while learning the language and potentially dangerous later. You're going to almost never hit issues from it in a toy problem.

That said, I mostly use this in toy problems because I'm lazy and it's low- to no-risk. Do you think it would be better to encourage new learners to use using std::string; instead of the whole namespace?

@arcuru
Copy link
Copy Markdown
Contributor Author

arcuru commented Aug 3, 2019

I'm going go go ahead and merge this, I think this will be an improvement over the existing at least.

@arcuru arcuru merged commit fb97677 into exercism:master Aug 3, 2019
@arcuru arcuru deleted the hw_improve branch August 3, 2019 21:39
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.

Improve hello-world

4 participants