9 ms·
I spent a lot of years writing C++ code and really enjoyed it, it’s a fun language and you can pretty much do anything with it. But the problem I encountered wi
by rcurry 5y ago
I spent a lot of years writing C++ code and really enjoyed it, it’s a fun language and you can pretty much do anything with it. But the problem I encountered with it was that it just became so wide in terms of features that you have a hard time keeping up - you can spend years using the language to build real software and then walk into a job interview and get demolished by all sorts of crazy stuff you didn’t even know existed. I remember purchasing the book “Modern C++ Design” by Andrei Alexandrescu and after reading it I realized it was time to find something else to do. It was an awesome book and I loved it, but all I did was work on trading systems and I knew I’d never be able to keep up with C++ interviews if that was the direction they’d be taking. But I still love the memories of working with it, so much damned fun.
- bob1029 5y ago> so wide in terms of features that you have a hard time keeping up This is why I like the slightly more walled-in gardens of the JVM and CLR. For instance, when someone is talking about JSON serialization in C#, you could bet your life that they are referring to one of ~2 specific libraries and sets of methods. It is a lot easier to build a community of shared understanding when everyone is playing the same game every day.
- pjmlp 5y ago> For instance, when someone is talking about JSON serialization in C#, you could bet your life that they are referring to one of ~2 specific libraries and sets of methods. I wouldn't bet on it, https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-source-generator/ https://devblogs.microsoft.com/dotnet/try-the-new-system-tex... Also try to talk about Java 17 to clueless group of devs still delivering stuff into production with Java 8 in 2021.
- vips7L 5y ago> Also try to talk about Java 17 to clueless group of devs still delivering stuff into production with Java 8 in 2021. Id say it’s part cluelessness and it’s part that they just don’t care. They’re comfortable with 8 and don’t want to learn anything new (even if 8 is a slower runtime). I fear that the community will never move on past 8.
- pjmlp 5y agoYou could say the same of people refusing to move beyond C89, Python 2, Perl 5,..... and that is the whole point of perceived complexity and current features of those languages in 2021.
- bob1029 5y ago> I wouldn't bet on it, https://devblogs.microsoft.com/dotnet/try-the-new-system-tex https://devblogs.microsoft.com/dotnet/try-the-new-system-tex... This would be the 2nd of 2 that I was referring to. The first would be Newtonsoft.Json.
- pjmlp 5y agoExcept this is a new API, not the 2nd one. You have to modify code using System.Text.Json for the code generator based way, and it doesn't support all the features, enjoy the comments section.
- bob1029 5y ago> Except this is a new API, not the 2nd one. > and it doesn't support all the features I think there was a misunderstanding. We do not use System.Text.Json because it doesnt support everything Newtonsoft.Json does. At no point did I intend to make the claim that these were somehow compatible implementations. Our shop is stuck on Newtonsoft until Microsoft realizes that polymorphic deserialization is actually a really useful thing and not just a pedantic security concern.
- ryandrake 5y agoYou can take bits and pieces of C++ and never have to swallow the whole thing. I’ve kind of settled on C++11 as having all the tools I’d practically need. It’s got the right balance, IMO. If you’re interviewing somewhere that says they use every feature of the latest C++ in their software, run!
- colinmhayes 5y agoOk but I'm not sure I could go back to compiling without modules.
- deleted 5y ago[deleted]
- systemvoltage 5y agoWhat's the big deal with C++ being bloated (Linus, many experts don't like it) and I keep hearing that it has become unmangeable? C++ doesn't force you to use everything it's got. Can't I just write basic C style procedural code in C++ and use OOP constructs if necessary? It is completely optional I think. Don't like templates? Don't use them. Set a policy in the team/company to avoid using advanced C++ features.
- ratorx 5y agoIt’s not just about writing code though. If you want to properly read code you have to understand all the “advanced” features they have used. I’m reasonably familiar with C++, but not so much with arcane template meta programs. I never write templates, but it still trips me up from time to time when I have to understand one.
- deleted 5y ago[deleted]
- rightbyte 5y agoI guess the messy ugly template headers could be hidden as compiler intrinsics, like in Go with its compiler blessed generics for standard containers. Or how C's printf is implemented as compiler magic instead of vardiac macros. The complexity needs to be somewhere in the end. A charitable view would be that Cpp's approuch is more ... inclusive?
- truncate 5y agoYeah. All the arcane template stuff, even if I understand for sometime, you're bound to forget it as soon as you stop using it (which you probably should in most times). It reminds me, every time I try to jump too implementation of some standard library method/class, it just seems like a completely different language to me. And C++ is the language I've most experience with. Meanwhile, I jump to some Rust or Golang* standard library implementation, it makes perfect sense very quickly. Even though I just use them for hobby projects. * Go is probably a bad example because it doesn't have any generics. But still love how much more approachable their stdlib code is.
- belter 5y agoYou could be Scott Meyers, write: ==================================================== 1992. Effective C++: 50 Specific Ways to Improve Your Programs and Designs. 1995. More Effective C++: 35 New Ways to Improve Your Programs and Designs. 1998. Effective C++, Second Edition: 50 Specific Ways to Improve Your Programs and Designs. 2001. Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library. 2005. Effective C++, Third Edition: 55 Specific Ways to Improve Your Programs and Designs. 2010. Overview of The New C++ (C++11) 2010. Effective C++ in an Embedded Environment 2014. Effective Modern C++: 42 Specific Ways to Improve Your Use of C++11 and C++14 ==================================================== and you would not be able to understand modern C++ anymore... "The Errata Evaluation Problem" http://scottmeyers.blogspot.com/2018/09/the-errata-evaluation-problem.html http://scottmeyers.blogspot.com/2018/09/the-errata-evaluatio... "As you may know, I retired from active involvement in C++ at the end of 2015, and in the ensuing two and a half years, I’ve forgotten enough details of the language that I am no longer able to properly evaluate bug reports regarding the technical aspects of my books. C++ is a large, intricate language with features that interact in complex and subtle ways, and I no longer trust myself to keep all the relevant facts in mind. As a result, all I can do is thank you for your bug report, because I no longer plan to update my books to incorporate technical corrections. Lacking the ability to fairly evaluate whether a bug report is valid, I think this is the only responsible course of action."
- rcurry 5y agoWow, what a response. Thank you for taking the time to reply and I think you did a far better job of summing up the challenge of being a “modern C++ programmer” than I could have dreamed of. I had no idea that Scott Meyers had bailed on the language, I’m honestly stunned to read that.
- galangalalgol 5y agoWhat is our option now? Rust? I love it but it is moving 5x the rate of c++. Static analysis may save us in this one. Good tools will tell you when you did something the "old" way. I'm not sure which part of our pipeline that is. Cppcheck, coverity or some clang checker probably.
- FpUser 5y agoIf you build quality working programs that is what counts. Not that you can fly through some esoteric template shenanigans. When I being questioned by potential client we talk about what I've done and how (I design and build products usually from scratch). I also give references so people can check. If they start talking to me about can I write correct code in C++ or whatever other language right here I know I am in a wrong place. Normally such talk never happens.
- moth-fuzz 5y agoI feel like I'm in the minority in not finding C++ complicated. C++ has gotten significantly LESS complicated c++11 and onward, I'd say. Inheritance hierarchies with private/protected/friends and virtual methods lead to significantly more complex codebases than flat templates and judicious use of constructors and destructors to handle things' lifetimes. When you've got a nice templated API, writing the client code almost feels like writing in a scripting language. I'd say the only really hard part is understanding move semantics, but even then that's not really necessary and the verbiage on the internet is way too academic in that regard when it's really simpler in practice than it is when explained.
- ljm 5y agoHow much experience of C++ is required to understand that?
- pjmlp 5y agoI guess being around since the language exists. Just like looking at C# 10, Java 17, Python 3.9,... and making sense where the features or standard library calls came from.
- munchbunny 5y agoIf you have the luxury of making a clean break from old style C++, possibly. But, for example, in my case the only reason to touch C++ is precisely older stuff like native API’s. Because of that, I’m never writing purely modern C++. If I’m writing C++, it’s going to be a mixed bag of stuff with naked pointers, naked pointers to pointers, mallocs, and other fun stuff, meaning the subtle interactions between old and new features are always on my mind.
- pjmlp 5y agoJust like other languages, C++ is not (that) complicated, if you happen to have full control of the code being written. It is when you scale the team, or have a codebase that is being kept running since C++ exists, that the problems start. However, to be fair and something that C++ haters tend to cleverly forget, trying to update a .NET Windows Forms application written in C# 2.0 into C# 10, Java 1.4 into Java 17 and so on, will face similar issues in complexity and language idioms.
- tomthumb 5y agoAndrei also found something else to do after writing the book!
- mianos 5y agoSame for me, same. I spent years writing trading engines in C and C++ and have been rejected real quick because I don't use some modern template feature. A lot of stuff like the newer memory model and auto pointers are awesome but some of that template stuff is not for me when I look at the thousands of lines of assembly language, or worse still, huge chunks of code the linker does not throw out and is actually gets executed. I think it's just a 'flex' to attract candidates for particular culture fit so maybe, as another comment pointed out, it's probably best to steer clear of places that don't care for your real world experience in the field.