Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
black_berry
Posts: 54
Registered: ‎11-12-2008
My Device: Bold 9800 or Storm 3 whichever hits Verizon first.

Individual classes or inner classes

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.

Thank you all for your support
black_berry
Developer
geeneeus
Posts: 80
Registered: ‎09-12-2009
My Device: Bold 9700

Re: Individual classes or inner classes

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.)

Genius Development Scotland
Website: http://www.genius-dev.co.uk
New Developer
black_berry
Posts: 54
Registered: ‎11-12-2008
My Device: Bold 9800 or Storm 3 whichever hits Verizon first.

Re: Individual classes or inner classes

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.

Thank you all for your support
black_berry
Developer
dkonigs
Posts: 256
Registered: ‎07-25-2008
My Device: Bold 9900

Re: Individual classes or inner classes

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.

Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: Individual classes or inner classes

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.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
dkonigs
Posts: 256
Registered: ‎07-25-2008
My Device: Bold 9900

Re: Individual classes or inner classes

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".

 

Here's one:

http://docs.blackberry.com/en/developers/deliverables/3299/JDE_4.5_Fundamentals_Guide.pdf

(look on page 14)