I was very pleased to receive the following feedback on VanillaJuce directly from JUCE author Jules Storer himself. I have added a bit of formatting to improve legibility:
Great contribution!
But… if you’re posting your code for beginners to learn from, you really need to get up to speed with modern C++ practices, because all the old-fashioned stuff in here sets a really bad example to any newcomers who don’t know that there are better ways to do things.
I can see that you’re a proficient programmer, and I’m guessing you’ve written a lot of high-quality C in the past, but modern C++ is a very different beast and you need to lose all that old baggage!
So quick code review:
Hope that helps!
(Also, the list above is probably something that could be copy-pasted as a code review for hundreds of other projects that people have shared on here over the years!)
Jules's instinct is spot-on. I started out as a C programmer, and although I have used C++ since about 1991, I have not always kept up with how the language has changed. This is partly because I've had to code for many different platforms, including embedded systems and microcontrollers, where the latest language features are often missing.
It occurred to me that Jules's “quick code review” could form the basis of a nice little article, so instead of simply working through the list and updating the code, I've decided to document the process here, for the benefit of other programmers who, like me, may not be familiar with the latest C++ features and practices.
I'll start by reorganizing Jules's list into categories, and write something about each.
The following two items remain open at this point, pending further guidance from more experienced JUCE developers. I reviewed all my for
loops, and didn't see a case where using C++11 range-based constructs would yield improvement, and I'm not certain yet how inline member-variable initialization actually applies to my code (unless Jules was referring to the kinds of changes I already made to my GUI classes).
Comments welcome on the JUCE Forum!