Improves Hello-World#279
Conversation
|
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 |
|
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 |
|
|
||
| // Use everything from the 'std' namespace. | ||
| // This lets us write 'string' instead of 'std::string'. | ||
| using namespace std; |
There was a problem hiding this comment.
Is that really a good idea? This is actually suggesting to use using namespace std; all the time. Not a good coding style
There was a problem hiding this comment.
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?
|
I'm going go go ahead and merge this, I think this will be an improvement over the existing at least. |
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.