Required JUCE C++ Knowledge

Hi. I’m at the stage where I’m soon going to be starting with JUCE, but just polishing my C++ before I do. What areas of C++do I need to know inside out? For example, ‘templates’ or ‘smart pointers’. I’m using a site called Codewars to hone my skills where they typically have keywords which indicate what the challenges cover. I’m new to programming though I’ve used C++ in my masters and have now been doing it daily for about 3 months.

Any advice or even recommendations what projects or challenges to take on would be great. Thanks

Welcome to the forum! I also started out on Codewars and graduated to using JUCE a little more than a year ago. It was tough going for me at first, but lots of fun, and a great chance to learn a new art form.

You’ll find tons of things that you need to know about C++ “before” you start using JUCE, but don’t let them stop you from using it right away! The important thing is to get yourself in a position where you can learn as you go. I think the best thing you can do is get friendly with the JUCE documentation–it might seem intimidating at first, but in fact it’s a gold mine. Also go through some of the tutorials, if you haven’t done so already, and feel free to post questions here, even if they’re beginner level.

To give a direct answer to your question, I would say that the one thing you need to know inside out is inheritance. Many JUCE classes are built to be inherited, and so you’ll need to know how to inherit, how to override virtual functions, etc. (Having said this, knowing when not to inherit is just as important as knowing when to inherit).

I would say that templates aren’t that important. You’ll need to fill out a few template parameters now and then (ie. Array<SomeClass>), but beyond that you rarely need to use them, unless you have reason to design your own template classes. Smart pointers are very important if you want to write code that doesn’t crash. It’s very common to mix std::unique_ptr and std::shared_ptr with JUCE code, although JUCE also has some of its own smart pointers for different uses (SafePointer and OwnedArray are the two that I find most helpful, but there are many more).

There’s another point that I would like to make, which is that there is a big gap between knowing C++ and knowing software development. I like to think of it as analogous to knowing a language vs. knowing how to write a novel. Codeblocks is great for teaching you the language, but most of the solutions don’t need to go before a single function. A software application on the other hand requires hundreds of functions and classes, and the interaction between them gets very complex. I don’t mean to discourage you! You can definitely learn software development, just be ready for a whole new set of challenges.

Also, if you’re using JUCE to build a GUI, then you should know that basically everything revolves around the Component class.

Good luck, and don’t hesitate to ask more questions!

1 Like

Well C++ Is a vast topic, so honing your craft is a lifelong process. Juce code is also a very good bed to work on your C++ and probably you’ll get bitten more from high level architectural stuff (message thread Vs audio thread anyone?) Than if you jump into juce without a complete picture of what a unique_ptr is. Of course you always need the humility to go to cppreference and spend 10 minutes there when you see something that looks unfamiliar, but I’d dive into juce and maybe ask for forgiveness later (in this forum, mostly😀,)

If you feel a short concise C++ manual could help on the side of your jucer project I’m currently enjoying Stroustroup “a tour of C++” which is way more digestible than the language reference and also has in the last edition some C++17/20 topics.

Then the usual cppreference pages, cppconf YouTube videos , but always as a bedside help while on a practical project, not as a goal per se IMHO.

2 Likes

Wow amazing thanks that was just what I was looking for. Think I’ll dive in to JUCE v soon.

One last thing, I’m based in London so I imagine there’s plenty of Jucers around. Are there any social or other events that are worth going to? I literally don’t know a single programmer other than myself. Thx

I’d like to add lambdas to the list of C++ features that are good to know.

While a lot of mature JUCE classes use inheritance to override virtual functions to create custom behaviour, I get the feeling that newer classes and modern C++ std library classes in general tend to use more lambdas to implement things like callbacks and stl algorithms. As their syntax can be a bit confusing at first, they are not as intuitive as lots of the juce library classes and therefore worth a read :wink:

1 Like

Welcome!

I would recommend to learn the topics once you come across them rather than searching for topics beforehand.
Try to get exchange with other developers as often as possible. Either friends who do on the same level, or if you can more experienced developers (which is dificult, since everybody is busy).
But if you can strip out exceprts, you can get good advice by showing your approaches.

Don’t be disheartened, when things you wrote are criticised, we often write stuff that we were lucky it worked, and learn about the dangers later (especially about thread safety, parallel access of variables/not using atomics, locking, priority inversion).

But pick easy projects for the start and play around. Nothing helps more for learning like seeing your stuff growing.

There was a monthly JUCE/audio developer meetup until a month ago, but the venue where it was held went into administration. I don’t know, if it will be picked up again on a different location, I hope it very much!

Amazing, thanks so much guys!

Sort your search by latest post not relevance. I would love if some of the old posts could be labeled as deprecated or not the latest method.