The license appears there is allowance of altering framework functions. I wanted to pose this question, as at several points I would like to add my own functions and/or alter existing functions. I could always re-write to another class but wanted to clarify. If I document in that I have created my own function(s) and altered the provided framework, is this an acceptable method?
By the way Happy New Year!
You’ll be maintaining your own fork of JUCE if you do that. You should look at how often the JUCE team pushes to the Develop branch to see if you really want to maintain your own fork of the repository.
I have seen many active users pose the question of altering/adding to the framework. This is why I wanted to ask. It’s not a big deal to me, just would be nice if I was able to add my own functions of filters, delay’s, etc. (even without modifying the existing code), but adding to the classes.
I usually end up copying and modifying the class I want to extend. It’s much easier than having to maintain my own fork, and I can pick and choose whatever future changes I might need if the original JUCE class is updated.
If you don’t want to modify the original JUCE source code, why not wrapping your own stuff in a custom JUCE module? This is the “JUCE-way” of maintaining your own JUCE-based classes that are not specific to a single project and makes it super easy to add them to your projects, just as you are used to add/remove the original juce modules to your project.
Some great ideas it sounds. Was on the fence of modifying the framework code, and/or copying to another class.
There are more alternatives:
- inheriting an object and override the methods you want to change
(not always possibe, if you need access to private members or worse a private implementation / pimpl)
- aggregating an existing object:
write your own class as wrapper, that intercepts the methods but lets the existing class do the work
- explain your use case to the forum/juce devs and let them suggest a way how to do that without copying code.
Why copying code is bad:
The copy is cut off from further development:
- you will have to monitor the original and port bugfixes to your class (nobody manages that in the long run)
- the interface of the original class may change, so you will have to adapt your class again (and now figure out, which part is copy, which part is intentional change, and which part was accidentally forgotten or changed)
Writing modules is a great way to write reusable code.