8 ms·
This sounds like a lot of fun, but I'm concerned about the limited ROI. How many practical, modern use cases does Cpp have at this point for those of us who don
by doktrin 9y ago
This sounds like a lot of fun, but I'm concerned about the limited ROI. How many practical, modern use cases does Cpp have at this point for those of us who don't work in a few very specific verticals like finance or game dev? Even in those aforementioned industries, C++ is reserved for niche roles / use cases.
Of course not all hobby projects need to be "practical" or directly useful - but time is a valuable resource and I at least would like to have an actual non-toy project goal in mind when choosing to better grok a language. What is C++ uniquely good for in 2017?
edit :
Useful answers to this question -
* extending libraries for higher level languages
* embedded dev
- zelos 9y agoA lot of embedded work uses C++ IME. There seems to be a reasonable demand for it from the job adverts I see.
- dom0 9y agoTBH it sounds like you immersed yourself in the "everything is node or go or rust" HN bubble. C++ is one of the most widely used languages for application development.
- doktrin 9y ago> TBH it sounds like you immersed yourself in the "everything is node or go or rust" HN bubble I find that when someone's made up their mind about me based on little to no data, there's not much point trying to prove them wrong. > C++ is one of the most widely used languages for application development What kind of applications?
- ajdlinux 9y agoAnywhere that deals in embedded development, you're going to have to touch C++ at some point.
- dom0 9y ago> made up their mind "sounds like" is very much the opposite of that. > What kind of applications? All of them, except web pages.
- doktrin 9y ago> All of them, except web pages. This is just factually untrue. Mobile, desktop, data analysis, machine learning and even games : neither are primarily developed with C++ these days. I imagine you're going to respond with snark about how game engines are written with Cpp, or mention some edge case where a CLR / JVM language needs to call out to native libraries - but there's no escaping the fact it's a niche skill set and one of rapidly diminishing importance to the overwhelming majority of developers.
- dom0 9y ago> Mobile development Android NDK, Objective-C++, ... > desktop applications There are plenty of applications written in C++, from legacy code bases like MS Office to almost all content-creation tools ever, most applications whose abbreviations contain "computer aided", many libraries, and boatloads of applications. Like I said, C++ is used practically everywhere. Most applications developed on Qt are C++ (some Python). Qt itself has already a large user base. > data analysis From matlab to gnuplot, oscilloscope and spectrum analyser software, data analysis applications are frequently developed using C++. > machine learning On many repositories I can rather clearly see a broad pink bar, e.g. https://github.com/search?utf8=%E2%9C%93&q=topic%3Amachine-learning+&type=Repositories https://github.com/search?utf8=%E2%9C%93&q=topic%3Amachine-l... https://github.com/tensorflow/tensorflow https://github.com/tensorflow/tensorflow - If some proprietary application is not obviously written in .NET or Java, C++ is a safe bet.
- doktrin 9y ago> Android NDK, Objective-C++ Those toolkits are only useful for edge cases. SDK performance is adequate for 95% of real world applications. > From matlab to gnuplot, oscilloscope and spectrum analyser software, data analysis applications are frequently developed using C++. I.e tools that don't need to be re-implemented, some of which had they been built today could easily have been written with a bytecode / JVM / CLR language. > On many repositories I can rather clearly see a broad pink bar, e.g. https://github.com/search?utf8=%E2%9C%93&q=topic%3Amachine-l https://github.com/search?utf8=%E2%9C%93&q=topic%3Amachine-l In your own link C++ ends up in a distant 6th place. What is that supposed to prove? That it's more popular than JavaScript in ML development? > https://github.com/tensorflow/tensorflow https://github.com/tensorflow/tensorflow Another tool I'm not re-implementing. You conveniently left out that all of their models are developed with Python - which is what 99.99% of developers interested in ML are trying to do.
- joshvm 9y agoIn terms of application development, cross-platform GUIs are a pain in virtually any other language, ignoring platform specifics like Objective-C or dot net. Ever tried to ship a frozen Python binary? Never again. It's a little like saying what are some good modern uses for Java? Then you remember that millions of people use Android every day. I work in computer vision and deal with hardware a lot, both embedded (micros) and 'higher level' (cameras, random optomechanics). You get drivers in C/C++, often dot net, and occasionally other languages. Sometimes you get lucky and someone's written a Python wrapper already, but most of the time it's faster just to use the C++ (otherwise now you have another library to maintain and keep up to date with the vendor - someone else can do that!). If you work in web development, it's easy to forget that you can't just write a backend in Python and then make it look snazzy with CSS and Javascript. It's one of the few areas where C++ doesn't have much penetration. That said, browsers are written in C++ (Firefox and Chrome, for example) and of course the web servers themselves (plus some C). The combination of C++ and Python is very powerful. Modern C++ is very easy to read and if you use the STL, you can write surprisingly compact code. I'm also a big fan of Qt for GUI development (plus the other bits you get with it).
- doktrin 9y ago> It's a little like saying what are some good modern uses for Java? Then you remember that millions of people use Android every day. Of relevance here, millions (or whatever) of developers need Java every day to build Android applications and all kinds of line-of-business applications all over the world You can't say the same thing about C++, even if developers build ontop of C++ tools. That is the very point I'm driving towards : not that Cpp isn't an important language or ubiquitous, but that 99% of developers don't have a realistic need for it in 2017. Yes, it's an important language - but only like 0.1% of developers actually have a good reason to use it. > If you work in web development Or mobile development, or game development, or desktop application development - i.e. the vast majority of apps that consumers actually interact with don't require much if any C++ development even if they rely on tools written with C++.
- lossolo 9y ago> You can't say the same thing about C++ I think most of what you write is based on your imagination about C++ instead of facts and the facts are different. There are millions of C++ developers on our planet. Read this: https://blogs.msdn.microsoft.com/zxue/2016/10/24/how-many-developers-use-c-vs-c-vs-other-programming-languages/ https://blogs.msdn.microsoft.com/zxue/2016/10/24/how-many-de... And those are only one IDE (Visual Studio) stats.
- kronos29296 9y agoMost competitive programming is done in C++. It probably will be in near forseeable future. This is because of speed and STL.
- mhtxhn 9y agoChrome, Firefox, Adobe CC, etc. Node requires V8, which is written mostly in C++. Remove C++ from software development and check what is still working...
- doktrin 9y ago> Remove C++ from software development and check what is still working... Remove opcodes & assembler from software development and check what is still working... See how completely absurd that sounds?
- deleted 9y ago[deleted]
- CogitoCogito 9y agoI feel like C++ interacts with Python very nicely and so if you're a Python programmer, learning C++ can be very useful. I use Python and common libraries (e.g. numpy) for most things and then write extensions in C++ if that portion of the code becomes a bottleneck. You can use pybind11 or boost::python to do this pretty easily (though I personally tend to use the cpython C api directly myself). I think this provides a very nice balance between programmer efficiency and machine efficiency. I wouldn't say that C++ is _uniquely_ good for this (C could be used as well as any compiled language that can expose a compatible C ABI which includes Go, Haskell, etc.), but I do feel like the addition of RAII and exceptions matches the Python paradigm quite well.
- dom0 9y ago> as well as any compiled language that can expose a compatible C ABI which includes Go I don't think that's true. Go only has a FFI to the platform's C ABI (cgo).
- CogitoCogito 9y agoI'm not sure what you mean by this. Haven't you had the ability to specify as C ABI with the standard golang compiler since 1.5? I don't believe you need cgo. Maybe I misunderstood your comment? https://blog.filippo.io/building-python-modules-with-go-1-5/ https://blog.filippo.io/building-python-modules-with-go-1-5/ As long as you specify the correct interface, Python will happily load your modules.
- dom0 9y agoDidn't know that. Thanks!
- cr0sh 9y ago> I feel like C++ interacts with Python very nicely and so if you're a Python programmer, learning C++ can be very useful. I'm currently taking Udacity's Self-Driving Car Engineer Nanodegree. Currently I'm on the 2 week "break" between term 2 and 3, which starts on July 6th. Anyhow, term 1 used Python (and various libraries of course) exclusively. When I signed up, I knew that at some point they were going to use C++ - so I was concerned if my system would need an upgrade (I use Ubuntu 14.04 LTS); but I was assured it would work ok. I was also concerned because I hadn't touched C++ since VS4 (ie - ages ago!) - and I was thinking "will I be able to do this - rusty isn't the word for my skillset in C++". Term 2 came around, and that's when reality hit - C++ was to be used almost exclusively thru the entire term. Fortunately, Udacity (as part of one of the lessons) gave us a free "preview" of a course they are developing to teach C++ (not sure if it will be free or paid) - and so I went thru that, and found that it was fairly easy! I suppose that my skills in other languages since I had last played with C++ (ie, PHP, Python, Java, Go, Javascript, etc) all worked to make it seem that C++ was "just another syntax". Granted, there are some things which I only barely grok (templates, for instance - but there are several others), but overall, I got things, and was able to successfully finish my projects and complete the term. Oh - and I had to upgrade my gcc compiler, and a host of other things - because the version of gcc wasn't C++ 11 - which of course is what they were using mostly. So I got to do some unspeakable things to my workstation (and basically fubar'd it so bad I can't do an upgrade any longer - not without some serious work, but I'll leave that to the end of term 3)... I guess what I'm saying here is that the experience on the Udacity course led me to the agreement with your premise; C++ isn't really that difficult to pick up the basics of if you already have Python (and maybe some other languages) under your belt. That said - I am looking forward to seeing what Jai brings, if it is ever released to the public...
- adgasf 9y ago> What is C++ uniquely good for in 2017? C++ is special because it combines two big ideas: - Zero-cost abstractions (you only pay for what you use) - High-level abstractions (OOP, lambdas, code-generation, etc. ) I would jump straight to C++ 17. It looks completely different to early 2000s C++ and makes functional programming easier (type inference, lambdas, constexpr, etc. ). If you learn to use C++ well, you will be able to write faster code faster.
- userbinator 9y agoZero-cost abstractions (you only pay for what you use) True in theory and essentially because C++ still remains mostly a superset of C, but unfortunately the majority of C++ programmers I've met tend to overabstract and not realise it, making this claim not really true in practice. High-level abstractions (OOP, lambdas, code-generation, etc. ) On the other hand, this is definitely true in practice.
- adgasf 9y ago> "C++ still remains mostly a superset of C" I think this notion is out-of-date. Have a look at this slide: https://youtu.be/_wzc7a3McOs?t=21m37s https://youtu.be/_wzc7a3McOs?t=21m37s It shows how C++ has evolved away from just "C with Classes". I agree that many C++ programmers over-abstract things.
- userbinator 9y agoIt shows how C++ has evolved away from just "C with Classes". I meant that C code, with few modifications, will basically work fine when compiled with a C++ compiler.
- slededit 9y agoThe way it works out in practice is people can develop at a high level, and then when its needed you can go back and refactor where necessary for perf. The average performance does become slower though.
- codebeaker 9y ago
- arethuza 9y agoI suspect that it is likely that the browser you used to post that comment was written in C++.
- doktrin 9y agoThat's correct, and if I wanted to write a new web browser designed to be performance competitive against the big 3/4 I wouldn't have asked this question to begin with.
- jasode 9y ago>How many practical, modern use cases does Cpp have at this point for those of us who don't work in a few very specific verticals like finance or game dev? I understand your reservations but keep in mind that the blog post is intended for an audience that has already bought into C++ programming and therefore, may want to improve their baseline C++ skills. It's not an an evangelism article to convince those not using C++ right now. That said, to answer your question directly... I think that programmers who require high-performance code with low-to-zero cost abstractions will self-select into C or C++ ecosystems. In other words, a programmer thinking about writing a web app to track food recipes isn't going to be perplexed about choosing "C++? vs Ruby? vs COBOL?". Like you hinted at, the domain of the app constrains what the programming languages will be realistically chosen.
- doktrin 9y ago> It's not an an evangelism article to convince those not using C++ right now. I get that. Maybe I should have added a disclaimer to that end. > In other words, a programmer thinking about writing a web app to track food recipes You're maybe the 5th person who's made thinly veiled barbs about me being one of those despised subhuman web developers, so I'll just answer this once and for all : Though I have written web apps in the past, I'm not really a web developer. What I am is a developer who builds shit that people use - be it desktop apps, mobile apps, games or web-apps. I don't give two shits if I'm using RubyScript or a goddamn magnetized needle : if I need the tool I'll happily learn it. My only problem here is I can't find a good reason to learn C++. That's all.
- quantdev 9y agoNo one is trying to convince you to use C++. Obviously the data show there are tons of C++ jobs and this is something you can google yourself. And finance is not a "niche", considering it's like 20% of the US economy. I'm in finance and I write high-performance simulations and pricers. These things need to be predictable, fast, and the code needs to be maintainable. And yes, despite what the prevailing Go or Rust bros say, modern C++ is maintainable.
- StevePerkins 9y agoAre you asking about the ROI in terms of professional career opportunities? Probably three orders of magnitude greater than it is for Rust, D, Haskell, Lisp... or any of the other flavor-of-the-month darlings that HN uses in their hobby projects, but for which few jobs exist in the real world. Are you asking about the ROI in terms of learning and personal growth? Then it's tremendous. The language that you probably are using (Java or C#) was written because most average programmers couldn't handle the power and flexibility of C++, so industry developed those languages as lookalikes with training wheels. If you've ridden a bike with training wheels your whole life, then aren't you at least curious at some point to see what it's like with them taken off? If nothing else, then you'll learn why decisions were made the way they were in derivative languages, and become a better programmer overall. It gives you certain amount of confidence to have experience in a language that most people are afraid of.
- LMYahooTFY 9y agoDo you think the suggested books in OPs link are accessible to me if I've only a couple of intro to C++ and Java under my belt? Universities are a much longer and unfortunately financially inaccessible route for me. Going to try the "build-a-portfolio-and-start-freelancing" approach.
- zerkten 9y agoIt's hard to know without knowing what your intro to C++ looked like, and what your background is. If you can get through Accelerated C++, then some of those books may be useful once you've gotten some practice. From http://www.ensisoft.com/temp/cplusplus_stack.png http://www.ensisoft.com/temp/cplusplus_stack.png (why is this a PNG and not a JPEG?), Modern C++ Design and C++ Template Metaprogramming are likely to be the most challenging. Don't get me wrong, they are fantastic works, but are probably not what you need right now. C++ Primer, C++ Common Knowledge, and API Design for C++ are books that I think you should consider that are not listed in the post above. If you have never studied computer architecture it is an important subject to understand. There are good books like Computer Systems: A Programmer's Perspective, but others may have different opinions.
- lin_lin 9y agoLet me guess, you're a web dev?
- doktrin 9y agoYou guessed wrong.
- GuB-42 9y agoC++ still tops performance charts, beaten only by C, while still offering high level abstractions. C++, along with C, which you should also know if you know C++ is also used in the embedded software industry. Because it C++ is still essentially C, you write code for these tiny, bare metal embedded systems and still take advantage of some advanced features like classes, templates, etc... Where I live, C++ coders are in high demand in various fields, just to let you know.
- doktrin 9y ago> C++ coders are in high demand in various fields, just to let you know. What fields, aside from embedded? I'm genuinely curious.
- GuB-42 9y agoJust an example of a job I did 2 years ago. It was for a company that did stuff related to digital signatures on official documents. The part that deals with smartcards is written in C++. They are mostly a Java shop, not C++, and that's why the called me. This is an example of "off topic" missions you can find. Personally, I mostly work around embedded/industrial systems and everything that goes with it such as test and simulation tools. I know some people who work in scientific computing and C++ is used in this domain too.
- dopple 9y agoHigh performance computing / supercomputing is dominated almost exclusively by C, C++ and Fortran.
- bstamour 9y ago* High performance/scientific computing * Graphics * Infrastructure (web servers and browsers, OS's, drivers, etc) * Any desktop apps that are CPU/memory intensive. think image processing, video editing, even office applications * Finance * Games * AI. GPUs are becoming more popular for training machine learning models, and C and C++ are pretty much dominating this space with OpenCL, CUDA, etc. You mentioned in previous comments that browsers and stuff don't really count because you're not going to be implementing a browser that competes with the big four. But people have to work on maintaining those browsers. Same with MS office, Photoshop, etc. The world pretty much runs on C and C++. From the steering column in your car to the computational fluid dynamics models that predict hurricanes and save lives, to the telephone switches that route your cell phone calls. Until pretty much every important piece of digital technology, small or large, switches over to a new language, there will be a need for C and C++ developers.
- maxxxxx 9y agoC++ may not be uniquely good for this but most desktop apps you are using are written in C++. When you add C all your operating systems are written in C/C+, most web servers and databases are.
- doktrin 9y ago> C++ may not be uniquely good for this but most desktop apps you are using are written in C++ I disagree. Most desktop apps are written with some kind of bytecode language (like my code editors and IDEs) with a few being written in C++ for very specific reasons (like my web browsers). > When you add C I wasn't asking about C
- maxxxxx 9y ago"Most desktop apps are written with some kind of bytecode language (like my code editors and IDEs) with a few being written in C++ for very specific reasons (like my web browsers)." That's maybe true for your Dev tools but not for general purpose apps. MS Office, Adobe products, video players and other stuff regular people use are written in C++.
- smelterdemon 9y agoWhether or not you find C++ uniquely useful for more general (e.g. desktop application) programming, it's still one of the most popular languages. There are lots and lots of legacy C++ codebases that are being actively maintained and updated. OTOH the places where C++ is especially well suited may be niche but they also tend to be crucial.
- doktrin 9y agoYeah I agree with this. It got lost somewhere in this shitshow, but I really was just looking for something to use C++ for : obviously I won't be contributing to a legacy codebase or applying for a job maintaining [insert critical software] built in C++ people have cited.