7 ms·
Honest question here. How hard and frustrating is it to keep up with all this junk? As someone familiar with nearly a dozen scripting languages, I keep trying
by 7thaccount 3y ago
Honest question here. How hard and frustrating is it to keep up with all this junk?
As someone familiar with nearly a dozen scripting languages, I keep trying for something low level like C++, but it seems like these languages are impenetrable at times. It's hard enough to learn the machine stuff and manual memory management, but having the syntax change more often than a toddler's favorite color just makes it all seem impossible.
- pompino 3y agoWhy do you feel the need to use every single feature? Are you constantly joining new projects that use vastly different features? Most programmers find a handful of features that gets the job done, and keep using them. Your knowledge from 10 years ago (C++11) is still valid and useful.
- 7thaccount 3y agoMy problem is more about how to get started and use certain scientific libraries. Maybe I just need to dive in. I keep getting detered though when I find out that simple things like iterating through a text file seem to take up so much code. Then I need a dictionary and somehow have to figure out how to get that. Not trying to whine. It's going to be a lot of work though lol.
- protomolecule 3y agoGPT-4 can be a good help here. It mostly gets simple things right.
- Buttons840 3y agoIn one of Bjarne Stroustrup's books he recommends focusing on software engineering rather than learning every language feature, or something to that effect. I think it's good advice. (And it's a good coping thought, but no less true.) An actual engineer or carpenter doesn't master every conceivable tool before beginning their work, they can't, there's too many. Say what you will about C++ programmers, but at least they are free from the burden of trying to use a perfect language and can focus on more important things.
- wiseowise 3y agoIf you want what you describe you use Java.
- fsloth 3y agoYou don’t choose C++ because you want to but because you need to due to constraints that Java likely does not fullfill. As a C++ dev - If you don’t need C++ then choose whatever other modern language. We keep up with C++ because of specific constraints other languages don’t fill.
- angiosperm 3y agoC++ is overwhelmingly more pleasant to code in than Java. People use Java because they work in a Java shop. Similarly, COBOL.
- loup-vaillant 3y ago> Say what you will about C++ programmers, but at least they are free from the burden of trying to use a perfect language and can focus on more important things. I would say most programmers, in any language, are free from that burden: once they picked their language they can focus on those important things.
- bxparks 3y agoNo, but I need to know them to read other people's code. Every C++ programmer has a slightly different subset of C++ features that they consider "basic", "fundamental", or "essential". After 35 years of C++ on and off, I have pretty much given up it. I don't have the mental energy to deal with its complexity anymore. I will deal with parts of C++11 or C++14, mostly so that I can read other people's Arduino code. I think I would rather learn a new language (Rust?) than deal with the hairball that is called "modern C++".
- 01100011 3y agoThis 100%. The vast majority of programmers' lives is spent reading code. We need to be able to interpret, repair and extend the work of others. I often hear this defense of C++, that you only need to know certain parts and the rest are for "library writers". This is an absurd argument, but not exactly surprising from the core C++ cult(and I say this with 26 years as a C/C++ dev). It's almost as if there are two separate camps, one writing and maintaining production software, and another group which only works on language internals and is becoming further divorced from reality.
- wiseowise 3y agoAbsolutely this, 100 times. I will never understand “don’t use all features” argument. Open 5 C++ projects side by side and you’ll find 5 different languages and 5 different build systems that are nigh impossible to build if they deal with dependencies.
- UncleOxidant 3y agoSadly agree. I used to know something that was called C++ (or at least parts of it) and even used to get paid to program in it. But now that C++ has become this kind of constantly morphing target (see the discussion here about what the most modern way to display text to stdout is) it's just tough to get my arms around it anymore. It seems like there was a noble attempt to modernize C++ and certainly there are some welcome parts of that, but it's gotten so far out of hand now. At some point you just have to admit defeat and start over from scratch with something that has a more unified vision. I'm looking at Zig and Carbon for lowlevel stuff and Julia for mathy stuff now.
- freeopinion 3y agoGenerally true, but if you start from scratch and only learn "the good parts" you have to be careful that you don't accidentally wander into some syntax you didn't know had some other use.
- angiosperm 3y agoThat doesn't happen.
- gpderetta 3y agoAnd if you end up learning something new it would be an absolute disaster /s I learn something new all the time when I explore new codebases or even less beaten corners of existing codebases. Only a tiny fraction of the time it is a new facet of the language.
- gumby 3y agoSystems programming languages contain features most users don’t need but some users definitely require. Often those special features are needed to implement things in libraries so that ordinary user code doesn’t have to deal with certain low level details. Likewise ordinary user code doesn’t need to know about these new features! And C++ is explicitly a multi-paradigm language so there can be affordances for multiple approaches. You can even use it as an OOP language if you want! As far as syntax changes go, mostly they are in the direction of simplification and/or unification intended to make programming easier in the long run. So, for example, you can now in many cases write template generics without the elaborate template syntax. But the C++ is also pretty unwilling to break old code, so old syntax and obsolete semantics are still available should you so choose. This is confusing to people who come to the language later on. (Note that above I wrote “intended to make programming easier”. The case I cited of generics does make some things easier for me, but of course de gustibus and all that.)
- grumpyprole 3y ago"And C++ is explicitly a multi-paradigm language so there can be affordances for multiple approaches." - In other words, a jack of all trades and master of none. For a systems programming language, I'd want to be able to easily reason about where allocations, memory barriers etc are happening and I'd want an emphasis on correctness/verification (rather than ease of use). C++'s many abstractions, intended for applications programming, actually get in the way of systems programming.
- JoeAltmaier 3y agoThen use such a paradigm; it is explictly made possible.
- grumpyprole 3y agoThis is essentially the same argument as "one can write secure software in C++". If it's not enforced by the language and tooling, one can't safely assume anything.
- jansommer 3y agoI would start with C, then take it from there. Makes you think about memory management and pointers, and the language doesn't change much. C++ and Rust is a lot easier to process now that I know C, though they don't get prettier. Use ChatGPT for learning - it's good at writing and explaining C.
- angiosperm 3y agoStarting from C is the worst possible choice. C-like code is the source of errors and security holes, just like actual C. Instead, start using the most modern language your compiler supports. Everything you write will come much easier, with much less opportunity for mistakes, and be much more fun. You will hardly ever find yourself using pointers, and never allocate or free memory.
- jansommer 3y agoWell that's where the parent to my comment already is and still struggling with low level languages.
- angiosperm 3y agoHis mistake is treating it as a low-level language. C++ can be as low-level as you need it to be, but most of the time, no matter what you are doing, you don't need it to be.
- loup-vaillant 3y ago> I would start with C, then take it from there. I would be very careful with that approach. C is broken beyond repair, and C++ didn't fix it. The only sane way forward is a clean break with a cleaner syntax (or at least one that is truly context free, dammit), and fewer undefined behaviours. Much fewer.
- jansommer 3y agoInstead of going straight to the fix, like GC or RC, try and deal with it manually first. Try working in a language without templates/generics, figure out what that solves. And how does pointers work? You could figure it out in C++ for sure, but try C without all the cruft. It's a simple, lovely language on the surface. Use it to learn and move on to something else if you need to.
- hoten 3y agoThere's an experimental cpp2 "syntax reset" that aims to provide C++ but with just the modern/better defaults, which reduces the "junk", or needing to know what coding conventions to apply to make actual C++ not be full of foot guns. Herb Sutter has been working on it for awhile. My only exposure to it has been watching this recent talk: https://youtu.be/8U3hl8XMm8c?si=phHkBNFGaroYbeb9 https://youtu.be/8U3hl8XMm8c?si=phHkBNFGaroYbeb9
- einpoklum 3y agoI'll answer from the perspective of someone who uses C++ for work and for some personal projects. The answer is: Effectively not hard, because: 1. When you write complicated software - especially with older-standard-version C++ - you often have the thought of "Oh, if I could only do X more easily" or "wouldn't it be good if we could skip the tedious coding to make the compiler do Y?" - and then you either grit your teeth and write something ugly which works. But then, a few years later, you hear it mentioned that X' or Y' have been standardized, and then you know "Oh, good, now I can do that more easily". 2. Stuff that you _don't_ know about, that gets introduced - you typically don't have to know about. Either it's not relevant to you, or it is, but you're just writing old-style code. 3. The "junk" gradually makes you be able to write the code you want more easily. So, unless you want to do deep guru things - you can gradually even _forget_ things you used to know how to do, since you no longer need to know about them.
- liendolucas 3y agoTried C++ once and only once. After the compiler spit pages and pages of alien and incomprehensible errors I discovered that the language was not for me (I felt like I was battling against the language and the computer). Never looked back nor regretted about it. In my opinion is way way better to learn modern C (and good C practices) a zillion times. I think that Ken Thompson nailed it on C++: https://en.wikiquote.org/wiki/Ken_Thompson#%22Coders_At_Work%22,_2009 https://en.wikiquote.org/wiki/Ken_Thompson#%22Coders_At_Work... Also Linus Torvalds is a huge detractor of C++: http://harmful.cat-v.org/software/c++/linus http://harmful.cat-v.org/software/c++/linus But in the end everyone should pick whatever programming language feel comfortable with. Sometimes if you're pursuing a career in certain directions (e.g: game development) you have literally no choice but to knee down and learn whatever the industry is pushing to use.
- HarHarVeryFunny 3y agoThe GNU g++ compiler generates notoriously bad error messages, although they have gotten a little better, and you do get used to them (a bit like reading the entrails of a sacrificial victim to divine the future). The clang++ compiler, much more modern and built on the LLVM inftrastrucure, has much better error reporting. Occasionally, in desperation, I've compiled something with clang++ just to see the error message in cases where g++ was just too unhelpful.
- angiosperm 3y agoYou just read the first error message, and find where it says "at line #N" to see where the problem is. You can ignore everything after, however many pages you get, which is usually just a list of the functions you might have been trying to call, and can be long if there were lots of possibilities. Linux Torvalds has not looked at C++ since the '90s. C++ is a wholly different language now. The experience coding in it now much more fun, and it is easy now to write code that works the first time it is run (as is also seen with Rust).
- ljm 3y agoI'd say this is the typical case for most languages, especially if they try to compile the entire codebase and only report errors at the end. Take TypeScript, for example: if you bugger up a type definition or function call in one file, you'll have to wade through the errors of everything depending on it. Oftentimes you can go from 30 errors to just 2 or 3 with one simple change. The alternative is they fail at the first error but you don't get the root cause and end up fixing shit one by one if the problem isn't obvious. Especially with a new project in an unfamiliar language - start small and compile small, incremental changes. You won't end up with something you can't fix, which can't be said for installing dozens of dependencies up front and hoping for the best.
- jviotti 3y agoFrom my own experience, it seems a lot and overwhelming at first, but it quickly becomes natural the more you use it, just like with any other language. Plus like others said, you don't need to use every single feature out there.
- steveklabnik 3y agoI am not a C++ programmer, but I try and "keep up with all this junk" and also care a lot about how people learn programming. Programmers like really neat logical explanations for everything, but the real world is much messier. People do not acquire human language skills by learning a formal grammar, learning all the edge cases, and then finally speaking: they attempt to communicate as best they understand, and then refine their knowledge over time. The same works with computer languages. Not just C++. You don't generally learn every single detail before you do meaningful work. You just kinda try stuff and figure things out. Sure, you may practice specific skills, but that's just not the primary method of learning. And even in those cases, you don't necessarily learn everything before you return to practicing what you've learned: it's a process where the two activities feed into each other. You mostly just go "damn I wish there was a better way to do X" and then find out there's a paper someone wrote, and then you pay attention to its progress. Or you just keep doing what you're doing, and at some point, a blog post comes out that's a summary of what's new, and you go "ooh that sounds interesting, I should look into that." But for every feature like that, there's also features which you go "ehh I don't need to care." And that's generally fine. > having the syntax change more often than a toddler's favorite color No real syntax is different here, this is a function call like any other. And C++ changes on a three year timescale. Many scripting languages release new versions far faster. It's just stuff that's less familiar to you, and so it seems harder, but it's learnable. > It's hard enough to learn the machine stuff and manual memory management This is the bigger struggle with learning, moreso than "syntax changes." If you haven't done lower level stuff before, you also have to recon with that while learning. That does make things harder the first time you learn a new paradigm, just like if you'd never used a functional language before, you'd be learning about those concepts as well as the syntax and specific language semantics.
- fsloth 3y agoYou shouldnt need to ”keep up with a language”. A professional computer language should always have a ”LTS” mode where you can compile a decade old code without modifications. Otherwise the language is a toy.
- angiosperm 3y ago
- fsloth 3y agoI write C++ as my day job. The secret is you don’t need keep up. The standard is weird and getting weirder. And no, it’s not ”well thought out complex technical endeavour”. It’s a jury rigged pile of legacy code with tons of useless sugar, somewhat modern features, and weird omissions. C++ is a weird combination of pragmatic features, close to the metal performance (which you can junk if you don’t actually understand what is happening on machine kevel), universally abysmal tooling (compared to other current languages), huge ecosystem of super-usefull super-nontrivial libraries… a combination of super good and super bad. If you don’t need the super good stuff (which you don’t need unless you know you need it) all you are left with is the bad stuff. The C++11 is okay. C++ committee is a weird combination of clown-car non-savant idiots and super talented pros.
- angiosperm 3y agoC++20 is as much more pleasant than C++11 as C++11 is than C++98. Restricting yourself to C++11 or (as some have promoted) C++14 or C is to write bad code where you could be writing good code.
- deleted 3y ago[deleted]
- DoctorDabadedoo 3y agoVaries, but it is a layer of stress. I have around 10y in a field where getting rid of C++ is close to impossible and I'm more excited about maybe changing areas than spending ten more working with C++ codebases. The things that affect me the most are: - No standard / user friendly tooling: there is no package manager, getting dependencies "as easy as copying a header from this github repo" is messy, is a liability, generates toil, etc. - The language is very complex, i.e. there are 7 different ways just to declare a variable (I'm not even discussing templates, optionals and what not) and more often than not C++ projects spans years or decades, there is a natural mix of styles from people across different generations on what is "modern" and it's a sore to my eyes. At every release rarely things are removed from the language, but there is always something added. At every company, the subset of what features are reasonable to use, understood and well maintained can change drastically. That might be a company problem, not a language one, but it's something sistematic enough that I would say it's a language thing. - Every language has its gotchas, but with beginners interested in using fancy features of the language, the surface area is just too big. I've read once on the blog of a former member of the C++ technical steering committee, that at his best, when actively working with the committee and focused on this, he maybe knew 50% of the language spec. What are the odds of the common folk knowing the pitfalls and good practices of the language and that staying relevant in 5-10 years? Even though C++ is the language programmed the most in my career and I can appreciate how nice it is at the right conditions, I've come to accept that the tenets of the language, the way the TSC sees it (stability, backward compatibility, performance) no longer resonate with me and I come to appreciate the consistency, simplicity and ease of use of other projects, there is a bigger world out there and the pond of C++ issues is a place I would rather leave behind.
- protomolecule 3y ago"I've read once on the blog of a former member of the C++ technical steering committee, that at his best, when actively working with the committee and focused on this, he maybe knew 50% of the language spec." This isn't relevant. The standard is for compiler writers and library writers who use advanced meta-programming. "What are the odds of the common folk knowing the pitfalls and good practices of the language and that staying relevant in 5-10 years?" That depends. Some pitfalls just disappear like std::auto_ptr but I doubt anyone complains. Big changes came with c++11 and c++20, that is once in 10 years. While c++11 added move semantics and new initialization syntax that are somewhat complicated and hard to ignore, c++20's additions only make you glad that your life has become easier.
- bingo3131 3y agoA new version of C++ comes out every 3 years, and every 3 years you will get loads of blog posts giving overviews of the changes as well as YouTube videos of conference talks on different things, which I watch in general as part of my on-going learning and development. C++ completed a cycle of related versions with C++11/14/17 so a lot of firms have settled on C++17 for now. C++20 introduced a LOT of new language features, some of which are still being explored and implemented and is still considered bleeding edge. C++23 has been finalised but is still going through the final ratification as far as I know. It is absolutely fine to be a few years behind the curve, as unlike other languages (typically controlled by one company) where a new version ships at the same time as compiler/library support, for C++ the spec is released first and then the many different vendors implement it (in some cases approved features are implemented ahead of release - typically Microsoft gets library features implemented quick while other compilers get language features quick. Modules are the notable exception to this rule).
- pjmlp 3y agoAnd this is currently starting to be problematic, when combining as much backwards compatibility as possible, the care about ABI, and some stuff that actually doesn't work in practice when compilers start catching up to ISO.