08-22-2010 03:50 PM
Finally got my system all built squared away and some time to put to my own project.
Question regarding performance.
With BB devices would it be best to have individual class files or Big Classes that contain the coded inner classes?
Starting to UML out the files so I don't want to have to change it out later.
08-22-2010 05:09 PM
Best OO Practices would dictate to separate the classes as it makes maintenance A LOT easier.
As for performance, the only time you would want everything in one class file is maybe if you are writing a game.
Generally you won't need everything in one class and you won't lose performace.
(The only way you would lose performance in a proper OO enviroment is if it isn't coded correctly/tidily.)
08-22-2010 05:16 PM
Thank you again, I thought this was the case but I was making the assumption of such and did not want to go off of assumptions.
08-22-2010 09:07 PM
I know the official RIM developer documentation gives some general best-practice information (including some counter-intuitive stuff like making String constants not final) for the BB platform. There was also some mention of not going overboard with interfaces.
However, I do honestly wonder just how much of a difference all of this makes. Even when I have bits of poorly written and totally inter-mangled code, it actually runs fairly well. I also use plenty of inner classes and anonymous classes where it makes sense. When apps are slow or large, I often suspect it is really just complete and utter abuse of graphics resource data.
Of course you should always strive for clean and optimal code. That goes without saying. But as long as you handle String and image data cleanly, I'm not sure how much a lot of these other nitpicks matter.
08-22-2010 09:48 PM
Can you direct me to where in the documentation it says those things? I am developing a library which is a port of a C library. It uses many "replaceable" delegates and I supplemented that for interfaces so "not going overboard with interfaces" makes me nervous.
08-23-2010 06:17 AM
RIM tries harder and harder to hide it amonst an overflow of other documents with each BB OS release. It was seriously easy to find in the 4.2 days. Not so much anymore.
Look on the main developer website for a section called "Development Guides". Then dig around for something called "Fundamentals Guide - BlackBerry Java Development Environment".
(look on page 14)