6 ms·
'"C++ is abandonware, just switch to a modern language" narrative.' I think this narrative is still valid. For the love of god, if you don't need to use C++ fo
by fsloth 3y ago
'"C++ is abandonware, just switch to a modern language" narrative.'
I think this narrative is still valid. For the love of god, if you don't need to use C++ for a greenfield project, don't. I say this as a person who needs to write C++ daily.
Otoh, if you do need to use C++, it's likely there are no good alternatives, so unless you are Microsoft, Google or Facebook ready to invest few billions to a new language ecosystem, the most pragmatic approach is to, indeed, just use C++.
- GoblinSlayer 3y agoHow much of C++ ecosystem Qt uses compared to the size of Qt itself? Or Chrome?
- Night_Thastus 3y agoAs a C++ dev, I definitely disagree. C++ has a lot of advantages, like an enormous pile of easily-usable existing C and C++ code that you can hook in easily into any project. Chances are if there's a problem to be solved, someone has solved it in C or C++ and the code is out there already. It also has a lot of great support in terms of toolchains. Almost everything everywhere supports it out of the box, and you have your pick of any tools you want. It also works on fairly simple principles, so anyone with experience in programming can work in it without learning a completely new way of thinking. [Even if their code won't be amazing at first]
- fsloth 3y agoI must apologize if the below sounds acerbic. I've used C++ professionally close to two decades and developed a keen feeling of everything that is bad in it. (Still need to use it though). In general I agree with Mark Russinovich. Use a garbage colleted language, and if you really want a non-gc language choose Rust (which I really should learn). https://twitter.com/markrussinovich/status/1571995117233504257?s=20 https://twitter.com/markrussinovich/status/15719951172335042... There are cases when one should choose C++, but those are the exceptions. Graphics, computational geometry and so on are strong reasons to use C++ still. But not everyone needs that stuff. For moving strings and numbers around in a stereotypical business domain there are much better languages. C#. Python. Etc. "an enormous pile of easily-usable existing C and C++ code that you can hook in easily into any project." A lot of it is to help with the fact that the standard library in C++ is anemic. This is one of the reasons though why one would want to use C++. Some libraries exist only in C++, and yes, it's a good reason to use the language. "It also has a lot of great support in terms of toolchains." CMake? VCPKG? Conan? MSBuild? Meson? Scons? Bazel? Make? Xcode? The-android-thingy? How do you mix and match those? All of those are bloody horrible. And their combinations to the second power so. The only good thing in modern times is that most open source projects have picked up CMake with a fairly standard way of project configuration, which enables actually to reuse other's people code with surprising ease. The toolchains make a horrible language a doubly terrible. "It also works on fairly simple principles, so anyone with experience in programming can work in it without learning a completely new way of thinking. [Even if their code won't be amazing at first]" Calling C++ simple is a new one to me. It's an industrial language that is not a total failure. Yes, people can write programs with it. The problem is there are much safer and better languages to write general programs, thus selecting C++ is giving yourself an intentional handicap in term of value created. As an example of the complexity choosing C++ over something like C# gives you - To what extent is a C++ codebase cross compilable and runnable in say MacOS after you develop it in Visual Studio on Windows? That's right, you can't tell, the only way to verify your standard C++ has the same runtime behaviour is to run it on the said platform. And fix all the bugs. So to actually write cross platform code, you need to have some proficiency in all of the platforms to have any level of guarantee that the code actually works in it's intended runtime. Thus, a C++ codebase needs to come with a warning label telling every OS and processor it has been tested in. Most popular libraries are tested and run in all of the relevant platforms so this is not an issue for users. But I'm pretty sure the number of platform specific fixes per codebase is not trivial to make something work even remotely similarly.
- Night_Thastus 3y ago>Make? VCPKG? Conan? MSBuild? Meson? Scons? Bazel? Make? Xcode? The-android-thingy? How do you mix and match those? Almost everything I've seen is in Cmake, or can be easily interacted with it. But in general, just pick something you like and stick with it. Sure, they're not perfect, but this list is actually a point I was making - you have a huge array of mature solutions out there already. >Calling C++ simple is a new one to me. It's an industrial language that is not a total failure. Yes, people can write programs with it. The problem is there are much safer and better languages to write general programs, thus selecting C++ is giving yourself an intentional handicap in term of value created. C++ is a simple language with complex things you can choose to use. If you understand the basic principles of loops, variables, functions, arrays, etc, you can write in C++ right away. You can layer on greater complexity with libraries and the STL, better patterns etc as you go, but you can start simple. That's a great benefit to someone learning, IMO. C++ is as complex as you make it. I prefer to write fairly simple C++ personally and only break out the harder parts when absolutely needed. For example, I really don't like lambdas, so I just don't use them. And I can still solve anything I need to without them.
- wiseowise 3y ago> Almost everything I've seen is in Cmake, or can be easily interacted with it. But in general, just pick something you like and stick with it. Sure, they're not perfect, but this list is actually a point I was making - you have a huge array of mature solutions out there already. Installing library is cargo add X npm install X implementation(“X”) Show me how to import library in CMake. And then also show me how to import library that doesn’t have CMakeLists.txt file. > C++ is a simple language with complex things you can choose to use. If you understand the basic principles of loops, variables, functions, arrays, etc, you can write in C++ right away. You can layer on greater complexity with libraries and the STL, better patterns etc as you go, but you can start simple. That's a great benefit to someone learning, IMO. C++ is as complex as you make it. I prefer to write fairly simple C++ personally and only break out the harder parts when absolutely needed. For example, I really don't like lambdas, so I just don't use them. And I can still solve anything I need to without them. Good luck explaining to team that they can only use subset of C++. Also good luck when advanced C++ dev advocates for feature X and now whole org has to learn about X and its drawbacks. Or when the dev leaves and rest of team doesn’t know how the hell it works. Sounds to me like you’re writing all of this from hobby or hobby OSS project perspective. Which is completely fine, but doesn’t apply to orgs.
- wiseowise 3y agoEverything that you’ve listed also applies to any modern mainstream language.
- Night_Thastus 3y agoRust doesn't have those decades worth of libraries and tool development baked into it. Nor does any fairly new language.
- wiseowise 3y agoJava has incredible tooling, far more advanced than whatever exists in C++ world. If you're looking specifically for "fairly new" language then Kotlin is your bet. Tooling is almost on par with Java. Can utilize ALL of Java ecosystem on JVM. Multiplatform (JVM, JS, native). C#, TS if you're looking outside of JVM.