It took some time, but I refined the main topics of the syllabus and would like to have your comments on them. I see C++ as one of the basic programming languages, that has spawned many others. For that reason many concepts are familiar, but it would be good to go over the basics in a sorted manner so that the fundamentals are clear. There is no fun in using std algorithms and std containers, if you don’t have that basic understanding. So without further ado: these are my 16 22 Concepts that would kick off the first batch. Don’t mind the order for now.
float, char, (size_t)
if, switch, initialization statements
for, ranged-based for
Copy and Move
new / delete
Class and Function, Situated in Header Files
Show Custom Iterators
Return Types, Arguments
I hope I can follow up with a deep dive into algorithms and containers afterwards. Also, I think we should add some C++17 / C++20 etc sections at some point.
I split the concepts and made an extra concept for code organization. This might seem obvious to many, but it is quite confusing coming from other languages to have header and implementation files (and namespaces that are not strictly bundled to a file(name)).
I think that at least std::vector could be squeezed in with these concepts. It seems like a very natural extension of the arrays and also enables some of the other things like iterators and range-based for.
About the templated nature of the containers I wouldn’t worry too much, I learned how to use various STL containers way before I created my first templated function or class and still I had a pretty good idea of the meaning of the <>.
@vaeng It’s a very nice list! The only thing I think you could consider is breaking things up into smaller concepts. For example,
Fundamental Types teaching Int, float, char, boolean and size_t seems like too much. In many tracks we use the following setup:
Have a numbers concept that explains the most common integral (int) and floating-point (float) type. Then have subsequent exercises for integrals and floating-point-numbers that go into more depth, for example by listing all the possible integral/floating-point types. With this setup, you can have a fairly basic exercise explain numbers and basic arithmetic, without having to teach everything about those numeric types.
I’d also move Logical Operators and the bool type into a separate exercise.
A similar reasoning can be applied to Loops. Currently, it contains quite a lot. while and do-while go nicely together, but I’d likely put range-based-for as a separate concept. And I think iterators also deserve their own concept, as it has quite a lot going on.
It looks pretty thorough. I think I’d merge copy and move semantics into the same concept - it seems natural to me that those are taught together. Also, in the Classes concept, you could talk about assignment operators.
About C++20 sections: are Exercism’s C++ exercises targeting C++20 yet? I was under the impression we were still targeting C++17.
I made the concepts smaller and more concentrated. I think it looks a lot better now. I think it is best to try to fit them into a tree before I move on. Might have to juggle some smaller parts around for that.
When the tree seems right, I would look at other tracks that teach similar things and mix and match them. Implement these first, then go on to work on the linking parts to have a basic structure. Lastly, I would do the Cpp-specific concepts.
I wonder when I should fit in the existing practice exercises. Maybe at an earlier stage, when I know the tree? Currently, there are no prerequisites at all for any of the exercises.
This is the only concept I’m unsure of. They (float/char/size_t) seem to be quite different things, so you could consider just making them different concepts.
Other than that, this is start to look really good!
Excellent idea. Forking from existing exercises is a great idea. One tiny suggestion: when you do an exercise on boolean logic, I would recommend forking Elixir’s Pacman Rules exercise instead of Elyses Enchantments.
I have to see how other tracks did those. At the moment I think they are too small to justify a whole concept for each. Char and size_t are mostly aliases of certain integers and float is a smaller double. I was aiming to have some conversion exercises to bring those together.
I have to think about what kind of exercise would be good to have the students juggle with signed/unsiged and different bit sizes. Or does anyone know a good concept from another language that has done that before?
Grains is a good one for that I think, although it also has to do with bit shifting. As the chessboard has 64 squares, a 32-bit int wouldn’t be enough, nor would a 64-bit signed int. Also, for the total, if the formula for the sum of the geometric progression is used, the answer is (1ULL<<64) - 1 which overflows for 64-bit ints, and there is that.
And it would only cover that “limit is not high enough”. So students don’t get why it might be smart to use uint8 and always use int64 everywhere, because that is “safe”.
I would have to make up something that is memory restricted or some other sensible scenario. That might play into other languages that have the same restrictions.
“Fundamental types” is a technical term in the standard (a type can either be “fundamental” or “compound”.) If you meant this in a colloquial sense (“the most basic types” like int, double, char) I’d suggest a different term.
I wouldn’t put size_t into the same category as float and char. It is an important type but it is used in different (and more advanced) contexts. I’d rather introduce it later, maybe together with containers or std::ptrdiff_t.
You could consider introducing std::array together with arrays and std::vector. It’s only a little bit more cumbersome to type than std::vector but it’s much easier to handle than C-style arrays because it doesn’t decay to a pointer, knows its size, and can be passed to and returned from functions.
In “Conditionals” what is “initialization statements” supposed to mean?
The conditional operator might be a good fit for the “Conditionals”
That is correct. Therefore I aim at C++17 until Ubuntu 22.04 would be the latest LTS and therefore our baseline. At least this is how I understood it from Siebenschläfer.
in the past we’ve said that our minimum supported version should be the default installs on the oldest Ubuntu LTS version. If that still makes sense, we can now update the default to C++17, and updating to C++20 could be done when Ubuntu 18.04 goes out of support in April 2023.
This includes an update to g+±10.
Clang is at version 6, I would happily update that to a newer version. We can have up to version 12 on 20.04.
Currently, there is only MSVC that completely covers all C++20 features. For g++ and clang there are small gaps here and there. I think they are not touching the features of our exercises, so we might have to discuss if we should call the track C++20 compatible.