I am new into a professional project, which uses mt4j library ; the fact is, I need to refactor part of the code, and I am wondering about the best practices in some cases.
We need to customize some mt4j elements, for example the MTSceneMenu ; for now, previous developers simply copy/paste the class in a new package and modified what they want. I think it would better to create a new class extending the mt4j one, but here is the problem : most of the attribute are in private, so I’m not able to call them from derivated class…
What do you think about this problem ? Is the copy/paste method the right one ?
Thanks you
You can modify the library itself, instead of just inherit the classes that you want to change. It is very unlikely that you’re going to need the original behavior, since you are already changing it to meet your needs. This way you have access to the private field and don’t need to duplicate code as well.