Hacker News new | ask | show | jobs
by InTheSwiss 4597 days ago
Python yes as it is helpful in many different places but Haskell and OCaml?! I know this is HN but these languages are pretty niche and only really used to any serious degree within academia. C++ is still one of the most flexible languages for application development on every major platform and with C++11 it has had a massive resurgence. Compare how things were a few years ago to the massive amounts of work places like Microsoft are putting into their C++ technology offerings. Visual Studio 6 all the way to Visual Studio 2010 had god awful C++ support outside of what Microsoft wanted to offer. With 2012 and now 2013 things are a hell of a lot better. Check out Microsoft's GoingNative 2013 stuff.

As for C it is a great language but it is pretty much only for either old stuff or system level stuff. In the real world I see people pick C++ over C if possible.

2 comments

"Haskell and OCaml?! I know this is HN but these languages are pretty niche and only really used to any serious degree within academia"

Maybe so, but the programmers I know who have switched from C++ to Haskell/OCaml/F# never seem to regret it. They are getting more done in less time, and spending a greater fraction of their time writing good software than tracking down annoying low-level bugs. The small trade-off in performance does not seem to be an issue, and in the few places where it is, some C or assembly code invoked via an FFI solves the problem.

"C++ is still one of the most flexible languages for application development"

Only if you are not counting the overhead of actually getting a complex C++ application to work reliably. Even the new abstractions in C++11 and C++14 seem to force programmers to deal with low-level issues than in almost every case are a distraction from the high-level problem being solved.

How many top tier games are written in Haskell or OCaml? If you did I bet you'd be less productive than one using C++.

All languages make tradeoffs. You need to understand your domain and the tradeoffs associated with them.

The point is, C is worth learning because of what it teaches you. Likewise Haskell and OCaml are worth learning because they'll make you a better programmer. C++ is only worth learning if you're looking for a career in the gaming industry and therefore need to know it to get a job. C++ is a terrible language that does pretty much everything wrong. The fact that it's only with C++11 that the language starts to become bearable should tell you something. Learning C++ will not make you a better programmer, it will make you a more employable programmer, although even there something like Java or PHP will make you a even more employable programmer.

If you're doing any embedded programming you're going to be using C. C++ is pretty much exclusively used in the gaming industry, and there mostly because of historical reasons more than anything else (all the popular frameworks are written in C++).

> C++ is pretty much exclusively used in the gaming industry

I'm curious how you've come to that conclusion? C++ is used in most of the major web browsers, most of the major database engines, most of the major office program suites, it's widely used at Adobe, Microsoft and Google... C++ is in the top 5 of most language popularity rankings (TIOBE, langpop).

Sure, C++ has its issues, but claiming it's only used in one industry is way off base.

Most new development isn't done in C++, all the things you're referencing are primarily legacy applications (legacy in the sense that they were originally written a long time ago, not deprecated). Most new software even at the companies you list isn't written in C++. MS for instance has thrown their weight behind C# as their go to language. Google among many things has Go to replace most of the things they used to use C++ for. I don't have any insight on Adobes usage, although I do know that most of their dev tools are built on top of Eclipse which is JVM based.

As for office suites, there's three of them out there, MS, which is C#, Apples which is ObjectiveC, and LibreOffice which so far as I know is Java.

I wouldn't be entirely surprised if a lot of the DB engines are done in C++, but I also would expect quite a few of them to be done in C as well. DB engine is a rather specialized area that demands the best performance you can possibly achieve, so something low level like C or C++ is to be expected. In order to achieve top performance you need to sacrifice ease of use so a really basic language like C or C++ is expected.

Interestingly enough looking at the source code for Firefox there is indeed some C++, but there's actually a lot more JavaScript in the Firefox source tree than there is C++.

Microsoft's Office suite is primarily C++. There was an attempt to start using more C# a couple years ago, but it's still mostly C++.

On a closed-source project, it's hard to get the details. But the open source projects, however, we can get a very clear picture.

  OpenOffice: [1]
  10.4 million lines of C++
  1.2 million lines of Java

  *edit* noticed you mentioned LibreOffice, not OpenOffice
  LibreOffice: [2]
  5.7 million lines of C++
  0.4 million lines of Java

  Firefox: [3]
  4.0 million lines of C++
  1.8 million lines of C
  1.7 million lines of javascript

  MySql: [4]
  7.0 million lines of C++
  4.0 million lines of C
  0.4 million lines of javascript
  0.3 million lines of Java
The point I'm trying to make is that C++ is widely used, and definitely not used just for gaming.

> Most new development isn't done in C++

Whether or not C++ is the right choice for new development is a different question. Github posted their top 20 languages for new repositories in 2013 [5]. C++ is #6 and has more new projects than C, Objective-C and C#. Even if it's fading in popularity, that's still a lot of new projects in C++.

[1] http://www.ohloh.net/p/openoffice/analyses/latest/languages_...

[2] http://www.ohloh.net/p/libreoffice/analyses/latest/languages...

[3] https://www.ohloh.net/p/firefox/analyses/latest/languages_su...

[4] http://www.ohloh.net/p/mysql/analyses/latest/languages_summa...

[5] http://adambard.com/blog/top-github-languages-for-2013-so-fa...

Most new development at Google still uses C++ (or Java). Go has been making inroads, but it is still largely used by early-adopters or small intranet or prototype applications.

Source: I work at Google and use all the languages in use at the company (including both C++ and Go) on a daily basis.

I agree C and Haskell are both worth learning as they will teach you a lot of should make you a better programmer due to the different point of view they give you towards development however this question was if learning C++ was worth learning.

The answer to that question, IMHO, is yes which is what the OP wanted to know. Had they asked what languages they should learn I would put other languages above C++ but that wasn't their question :)