JUCE or standard library for a newbie?


#1

I’ll finally get some free time, so I’m preparing to get started again in my C++ learning. But, I have a question I’ve been hesitant to ask here. I’ve had some exposure to programming (mostly C), but I’m a newbie in C++. I like using JUCE because for the 1st time in my life, it allowed me to write a program with GUI in Windows (big thanks to haydxn).

Question: Is learning C++ using JUCE a perfectly fine approach, or is this going to bite me later on?

I ask because all the C++ books I see in the bookstores teach using the standard library or STL (is it the same thing?). Am I learning C++ in a backward order? Are the authors not aware of JUCE yet? Wouldn’t it be really cool to see a book that teaches C++ using JUCE and the free MS Visual C++ 2005 Express? (maybe haydxn could do this?) :wink:

Or, am I completely confused here? :oops: I either use JUCE or standard library in a program, right? Or, in a real program, you use both at the same time?

I’d like some advice (or clarification) from experienced coders. I’m hoping this thread will be helpful to other newbies. Thanks in advance!


#2

STL is the Standard Template Library, the C++ Standard Library contains STL as well as the old C Standard Library.

There is no reason why you can’t use both STL and JUCE in one program, in code that deals with the GUI, you are most likely going to want to use the juce containers. But perhaps in another component, like a database, you may want to use STL.

I prefer the juce containers, I think they are easier to use, and lead to nicer looking code.

JUCE is new and has a very small user base compared to STL, which is why there is a lack of books.

Using juce could bite you later on. Only two licenses are avaliable, gpl and commercial. As well juce only supports Windows, Mac and Linux. These restrictions may or may not limit you, depending on what you want to do.

Also juce is written by one guy, if he gets hit by a bus tomorrow, that’s the end of juce. Mind you, it is open source, so somebody else may take it over.


#3

Thanks again G-Mon!

Oh, I see. It never really occurred to me to mix libraries this way. I thought JUCE supports XML for database stuff. I figured an audio program like Tracktion still needs solid and flexible database structure and the entire program was done using only JUCE. Maybe I’m wrong here.

If that’s the only reason, I think it’ll be okay with me. If I ever get good enough to code a marketable program, I wouldn’t mind paying Jules for commercial license. After all, I probably would not be in that position without being exposed to JUCE.

[And these are my current thoughts]
I recently purchased a book called “Accelerated C++: Practical Programming by Example” by Andrew Koenig & Barbara Moo after reading lots of good reviews. The book starts off using standard library stuff. Although I can follow the book, I started thinking “this is pretty confusing trying to learn C++, standard library, and JUCE at the same time.”

Is it correct for me to say that the standard library and JUCE both contain whole bunch of similar classes/functions(?) but are implemented very differently? For example, I keep reading that JUCE’s string implementation is much better than the standard library’s. Further more, does this mean learning C++ is separate from learning these libraries? So, you can learn C++ language only, then learn to use any library you want (e.g. standard library, JUCE library, library A, library B, etc). Or, is the standard library inseparable from C++? The libary is part of the whole C++ language? I hope these thoughts don’t sound very dumb. :oops:

I think all I need is a little bit more high level explaination to turn on the light in my head. After that I should have no trouble learning all the details on my own.


#4

STL is great - it’s mature, there’s plenty of info out there about it, and it has more features than the Juce containers do.

The main reason I wrote my own set of containers as well was to make the commonly-used objects more intelligible. Like you, I find the STL stuff confusing, mostly because everything seems to be so badly named. And if you actually open one of the header files and look at it, it’s like gibberish - variable names are one character, there are no comments… presumably to make it faster to compile, but it’s damned ugly.

It also has a policy of providing only the bare minimum number of methods, so any more complex operations have to be built up from these. That’s very neat in theory, but it makes your code unreadable - e.g. if I want to add a value to an array if it’s not already there, I’d like to type “myArray.addIfNotAlreadyThere (n)” rather than 3 lines of templated nonsense to do the same job.

But at least it’s up to you which ones you use - certainly there are things like hash tables that I’ve not done yet, so if you need one of those, you’ll need to go with STL.


#5

[quote=“sojuman”]
Further more, does this mean learning C++ is separate from learning these libraries? So, you can learn C++ language only, then learn to use any library you want (e.g. standard library, JUCE library, library A, library B, etc). [/quote]

That’s basically it in a nutshell. It’s not like Java where the libraries are the language.


#6

jules, thanks for your insight. Although I don’t understand the terminologies 100% yet (e.g. container = library or container = library within a library?), I think I see the big picture behind JUCE. I’ll keep learning so that I may ask you more intelligent questions later on.

valley, thanks for actually reading my confused thoughts. Your reply clears up my most basic confusion.

It sounds like I need to approach my learning in this order:

  1. focus on C++ core
  2. become “familiar” with the standard library
  3. learn JUCE

This could be boring, but I should be able to appreciate JUCE more and use it correctly. I wish there is a better way to learn all this stuff, though. :cry:


#7

container = array, list, stack, queue, etc. A class used to hold other classes.


#8

Doh :!: I should have known that. I remember now reading that from the book I mentioned earlier. This is what happens when I don’t get to study the language everyday. :cry:


#9