Originally posted by surendar prabu:
Which will give me better performance?
This is the wrong question to ask when you're designing an application. Don't get me wrong: One obviously can't ignore performance considerations. However, I've seen way too many developers get sidetracked on this relatively insignificant question.
The important questions you should be asking instead are:
Which technique/framework/methodology will make my application easily understood and maintainable by other developers?How can I make my application flexible enough to be easily modified when the inevitable change requests start coming in?Which technique best follows accepted patterns and standards for software development?These questions are orders of magnitude more important than "which performs best?".
When asking the above questions, the use of JavaBeans far surpasses the use of Collections and arrays of Strings. Quite frankly, I wouldn't care if JavaBeans performed 10 times worse than collections. I'd still use them because they meet the needs of maintainability, flexibility, and adherence to standards so much better.
Now after that diatribe, I'll finally get around to answering your question: There is virtually no difference in performance between using JavaBeans and using collections and arrays of Strings. Sure, you'll have a lot of Javabeans in your classpath, but so what? The latest JVMs can handle this quite easily.
Some developers get the idea that if they have to write a lot of classes and create a lot of layers in their application, this is somehow going to slow down their application. Nothing could be further from the truth. JVMs are designed to be efficient at branching between code in one class to that in another. Early JVMs were slow at instantiating objects, but not any more. You still don't want to instantiate more objects than are necessary, but you don't have to worry about the cost nearly as much as in the early days.