3 ms·
You are doing it wrong. You are not supposed to "learn" C++, not entirely. C is simple in the sense that the amount of things that there are to know about the l
by andrepd 11y ago
You are doing it wrong. You are not supposed to "learn" C++, not entirely. C is simple in the sense that the amount of things that there are to know about the language are small (it's about as low level as you can get) and it is possible and required to learn its computation and memory model and all its features to work with it.
In the case of C++, it's neither required, nor even possible to learn ALL of C++ (not without a couple decades of experience). C++ is a monster, a colossus, a many tentacled monstrosity of hundreds if not thousands of sometimes very complicated features. You cannot possibly master it all.
Yet the barrier to entry is as high as C, if nothing at least because C is a subset of C++. You don't have to be a template metaprogramming wizard and make full benefit of the latest standards' new features in order to know C++. As an example, in my work in physics I use C++ consisting of C, templates, the STL and POD structs. I don't use C++'s immense OOP tools simply because I don't like/don't need them. Someone else might use the full OOP features of the language. Still someone else might reduce it to C with templating because they like C but hate not having generic programming.
In short: C++ is what you make of it. Your C++ is a subset of the C++. It's your job to decide what features you want to learn and make use of. Don't feel like you don't understand C++ because you don't know Stroustroup cover-to-cover by heart.
- cma 11y agoThis falls apart as soon as you are working with codebases you didn't create all by your lonesome.
- andrepd 11y agoNo it doesn't, assuming there is an ounce of coordination and everyone is on the same page on coding standards and so forth.
- mikeash 11y agoWhat if you want to use a library?
- andrepd 11y agoWhat about it? If you decide to use a library, then you should learn to use it, no?
- mikeash 11y agoThen my C++ is no longer my chosen subset of C++, but rather the union of my subset and the subset used by the library. C++ is no longer "what you make of it" but what I make of it plus what the library author made of it. Bring in multiple libraries and you start to approach the entirety of the language again.
- alayne 11y agocma hit the nail on the head and you dismissed it. Two departments or companies aren't going to use the same subset of C++. Coding standards also evolve over time as languages evolve and better ideas about software engineering happen. 2015 C++ is much different than 2000 C++. Unless you always work on greenfield development with coworkers that strictly follow the same standards and C++ subset and you never do any kind of maintenance work, you will need to learn more parts of C++ than you may personally wish to use or learn.
- andrepd 11y agoWhat I mean to say is that that isn't the language's fault. It's up to the users to decide to make use of features they need, and obviously it's their responsibility to live with the headaches a misuse/overuse of C++ may bring. I guess I just don't understand why people consider "too many features" to be a shortcoming.
- alayne 11y agoI'm not arguing about too many features and you know it. Complexity and subtleties in a large language can make it difficult to write correct software.
- pzone 11y agoYes, it is harder to write correct software in C++ than in other languages. But if the project you are working on needs to be written in C++, explicit coding standards and the general project environment can play a huge role in whether it is a lot harder, or just a little bit. I can point to one policy that guarantees safety becomes much easier: prefer modern C++14 idioms whenever possible.
- deleted 11y ago[deleted]
- deleted 11y ago[deleted]
- angersock 11y agoassuming there is an ounce of coordination and everyone is on the same page on coding standards and so forth. That's a mighty large assumption. Typical physicist--at least you can approximate many C++ developers as spheres!
- andrepd 11y agoI don't think it is. Is it really so much to ask for developers in a team to decide on interoperability standards? I assume people on a team don't just start coding with zero coordination.
- alayne 11y agoEven if you had people agree on standards, there would be misunderstandings and people would deviate. Have you ever worked with standards for any sort of protocol/process/language? Try it some time.
- TazeTSchnitzel 11y ago> You are doing it wrong. You are not supposed to "learn" C++, not entirely. If you aren't expected to do this, or even to be able to, perhaps the language is poorly designed.
- sago 11y agoI agree totally about subsetting of C++. I worked for many years in the games industry when it was C or C++. And subsetting was the only way to make progress in C++. But it was painful at times, and required a tech lead who could really enforce their opinion about what code should look like. In the end, at crunch, code was often written that used features outside the subset, and everybody did find themselves having to figure it out, to learn more about the language. "Just use a subset" was always a solution better in theory than in practice for medium sized teams. How big is the team of developers you have in C++, and what proportion have written code in other C++ shops, and how time-constrained is your development? C++ for R&D type projects is very different from C++ for getting a shed load of features out the door on time, in my experience.