
Ways to Get Better at C++ - joboccara
http://www.fluentcpp.com/2017/06/23/7-ways-better-cpp-summer/
======
ensiferum
[http://www.ensisoft.com/temp/cplusplus_stack.png](http://www.ensisoft.com/temp/cplusplus_stack.png)

Just replace that Josuttis's C++ standard library with C++11 version and throw
in Mayers new effective book for good measure and you're all set

~~~
mi_lk
Surely you are joking right? I just can't imagine one has to go through all
those books to be proficient in one language.

~~~
fsloth
One is never proficient in C++. One merely... learns to adjust ones ignorance
to practical constraints. I.e you choose such a subset that you can deal with
it. But which subset? Hence, a shitload of books. The point is to read about
all sorts of styles and pick whatever feels practical for you.

And I'm completely serious. I've earned my living with C++ for over a decade,
am considered a valuable contributor and still... so clueless towards so many
details.

~~~
lloydjatkinson
Then C++ has failed. If it has so many competing standards and subsets, then
it is too fragmented. This is why when you see C++ written in one standard it
looks like a whole other language when you look at other C++.

If after a decade there are so many details still obscured from you, then
that's pretty much again a fault of the overly-engineered and tacked on
language called C++.

Other mainstream language work fine and allow you to still write clean and
modern code without having literally dozens of subsets and implementations. So
why is it that C++ feels the need to have so many?

~~~
flohofwoe
On the contrary, the one nice thing about C++ is that it is 'multi-paradigm'.
Don't like boost's philosophy of overengineering every little detail? Then
don't use boost. C++ without exceptions, RTTI, or even the whole STL?
Perfectly fine. Other languages don't have this freedom. It's a double-edged
sword of course. Less freedom also means wasting less time with pointless
discussions about which combination of C++ features is 'right'.

~~~
imron
> Then don't use boost.

After using boost in several projects and regretting it each time (slow
compile times, painful to configure), I finally learned my lesson and "don't
use boost" is now one of my guiding principles when programming in C++.

~~~
ndh2
While I would mostly agree, I would humbly suggest a small nudge in
perspective: Boost does not equal Boost. While I passionately hate most of
Boost, I find boost::optional to be one of the most useful template classes.
So you shouldn't treat Boost as one library, but as a collection of different
libraries. Same goes for STL in my opinion.

~~~
imron
I think boost has definitely had a positive impact on c++ and the fact that
large amounts of it are now in (or had a major influence on) the std library
certainly makes it much easier to forgoe using it.

------
questerzen
So I hate C++. What I really want is the speed, flexibility, universality and
simplicity of C. But I wish structs had destructors, and a way to bind
namespaced related functions. Only since I basically now have classes, I
should really think about adding inheritance. And I also find prototyping,
testing and non-speed critical programming is a pain without a good generic
container library. Containers can be implemented fairly elegantly with
templates, but then I probably also need some compile-time processing ability.
Oh crap, I just ended up at C++ again. And so I persist with C++ as my main
language, with a constant voice in the back of my mind saying, "this is just
stupid, there must be a better way. Why is there SO g __-d __* much accidental
complexity in this language? ". In my view, C++ has probably wasted more
programmer hours, and added more sadness and despair to the world (at the very
least MY world) than any other technology. But given my language wish list
it's very, very hard not to be tempted to fire up c++-mode for just one more
hit.

~~~
harrisi
Other than C, are there any languages that interest you? Are languages like
Rust or D or other systems languages not what you're looking for? How come?

~~~
questerzen
I use Python a great deal, especially for tooling and prototyping and
appreciate the fact that programming is fast, easy and focused on the inherent
complexity of the problem. Similar positive experiences with Smalltalky and
Lispy languages as embedded languages. But I write a lot of performance-
critical libraries for programs that need good C/C++ interop and where C++ is
pretty much the lingua franca. Swift, D and Go, for example, all have their
strong points, and I plan to do more experiments when I have some time ...
after this one last C++ project, though!

------
ot
> Improve your knowledge on Boost

I might be extremely biased about this, but I can't not recommend to follow
Folly as well
([https://github.com/facebook/folly](https://github.com/facebook/folly)).
There is some very good C++ there (and some bad C++ too), and it is generally
more readable than Boost. Some ex-Boost people work on it too.

The implementation of Function
([https://github.com/facebook/folly/blob/master/folly/Function...](https://github.com/facebook/folly/blob/master/folly/Function.h)),
for example, is mindblowing. I learned lots of tricks from it that I ended up
using in a bunch of places.

There's also a lot of interesting things happening in concurrent data
structures under experimental/ (and the widely used MPMCQueue and LifoSem are
also excellent).

------
StevePerkins
Can anyone recommend a good compiler/IDE learning setup?

I studied C and C++ back in university (I was in the wave of students that
came through after they switched from Pascal as the teaching language, and
before they switched to Java). And my first job or two back in the
early-2000's was using C++ in HP-UX servers, to talk to other systems via
CORBA.

But that was ages ago, and once I stumbled into a Java job I never left. Every
so often decide to scrape off the rust and check out C++ again, but the
ENVIRONMENT setup scares me off.

Should you use GCC or LLVM? If you're on a Windows box, do you try one of
those? (there's at least three different distributions of MINGW available) Or
do you use Microsoft's compiler? (VS has potential licensing issues, while the
freeware build tools are pretty arcane and it's hard to even find an installer
or know which exact thing to install) Or Cygwin? (I'm not 100% sure on the
current state of its licensing)

I've tried to build the wxWidgets library at least 100 times. It gives you
dozens of options for compiler and environmental setup, and yet I've never
found a choice that successfully built all the sample apps.

Once you have a compiler setup, what about an IDE? (Don't even start with the
" _just use Vim or Emacs_ " crap, I'm not an animal!) I love IntelliJ in the
Java world, but don't want to pay for JetBrains CLion just for hobby/personal
use. The last time I tried Eclipse's C++ support it felt pretty half-baked. Qt
Creator is actually really nice IDE (a C++ IDE _should_ be written in C++!),
but it feels very specific to writing Qt apps.

What about build tools? It's hard enough for Java newbies to wrap their heads
around Maven or Gradle. But makefiles and "configure" scripts are far more
arcane, and _which flavor_ of make should you be using in 2017? It's hard
enough to build a project that uses one of these large frameworks with
opinionated build systems. I wouldn't even know where to begin in _combining_
two opinionated build systems as dependencies of a single project, or creating
a new build system from scratch for a greenfield large project.

Once you have a compiler, IDE, and build system and are ready to start coding,
what about a standard library? Is Boost still the thing everyone uses? STL?
Something else?

I really can't imagine that learning C++ syntax is THAT challenging in
comparison to Java/C#, Rust, D, or anything else. But I'd love to see an
"Effective C++ Environment" book.

~~~
joshvm
On Windows, just use Visual Studio Community. You don't need anything else,
Microsoft's support for C++11/14/17 features is excellent. I'm not aware of
any killer licensing issues with the free version, the only limitation is that
if you're an enterprise (> 5 users, > $1M revenue, that sort of thing) you
need to buy a license. There isn't a problem with commercial development using
the free version. You may also need to provide the VC++ redistributable with
your application though.

As for standard libraries, the STL is _the_ standard library and you 'should'
use that where possible. Boost is a mix of potential features for C++, a few
modules that lots of people rely on (e.g. json, timers, asyncio), and a whole
lot of undocumented and unmaintained code. I get by without it most of the
time.

Qt Creator is pretty decent even if you don't use Qt. You can use the qmake
system which does lock you in somewhat, but it's easier to configure than
cmake for a newcomer. You still get debugging/profiling and intelligent
autocomplete/linting.

If you don't mind the large library overhead, you can use Qt for a lot of
brick-and-mortar code like dealing with filesystems, sockets/serial comms,
parsing XML, etc. It's very well documented, updated often and it's GPL which
is nice. Or you could statically link it. Personally I've found the Qt GUI
framework much more intuitive than the native Windows stdafx stuff.

~~~
jhasse
Qt is LGPL nowadays btw.

~~~
joshvm
Yep, typo!

------
maga
Ask HN: Do I miss much by skipping "Effective C++" and only reading "Effective
Modern C++"?

~~~
manaskarekar
In addition to the other replies, you might end up working on a codebase that
precedes C++11.

~~~
w8rbt
I would say that this is very likely.

------
doe88
So what are the best ressources for learning C++11/14/17 for someone who
already knows the _old_ C++ ?

~~~
derekerdmann
_Effective Modern C++_ by Scott Meyers

~~~
clishem
One of the best technical books in existence (afaik).

------
tapirl
it is easier to write fluent modern c++ code than read modern c++ code. The
big obstacle of modern c++ is to communicate between c++ programmers.

------
zakirenish
Good advice on learning functional language, learning OCaml helped me a lot to
advance my template meta-programming skills.

~~~
jnbiche
As a non-C++ programmer with a background in functional programming, this
similarity was a big surprise to me when I read a recent article on C++
template metaprogramming -- it's all basic functional programming techniques,
with recursion, (kinda) pattern matching, etc. Very interesting!

I could see how mixing templates with other C++ paradigms could quickly get
messy in the wrong hands, since it's very powerful.

------
sb47906
Bookmarked, thanks for this! You've covered books, course pages, tutorials and
videos as learning resources. Do you have any audio/podcast recommendations
with C++ material?

~~~
joboccara
Thank you! Well there is one podcast dedicated to C++: cppcast.com. Also I'll
publish a post dedicated to books about C++ that shows more recommendations,
during this summer.

------
faragon
Way to get better C++: write code that everyone could understand.

------
ryandrake
Just a nit pick for the author, take it or leave it: You use "STL" quite a bit
through your blog, when you probably mean to say "C++ Standard Library". They
are different beasts. You probably know the differences but beginners might
not and could become confused.

Otherwise, great article--that's a lot to dive into over a single summer
though!

~~~
StephanTLavavej
"STL" is a perfectly valid way to refer to the C++ Standard Library through
metonymy. Source: I am STL, an STL maintainer, with the sovereign right to
name what I work on.

~~~
ensiferum
Cool to have you here!

------
m712
I don't really see any advice here that's not generic.

------
doktrin
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

~~~
StevePerkins
Are 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
Do 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
It'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.

~~~
LMYahooTFY
Well I think my intro was pretty rudimentary. My knowledge of computer
architecture is as well, I can tell you what pieces do what, and what a buffer
is, but I couldn't really tell you how memory addressing, logic gates,
instruction sets work.

Is the JPEG question a test? If so I don't know!

The last ones you mentioned sound good, and I think I'll add those to my list
and start with Accelerated C++ and see how that feels.

I appreciate the info!

