Thanks a lot Craig. That cleared up a lot.
 
For the rest of 1%, I better put my question straight to the case.
 
I want to display two properties on 40*10 cell table. I have these options.
1. use a hashmap that contains 400 values. Or have four with 100 each so that I 
can have identical keys.
2. use a String that has 400 values (still have to substring on jsp)
3. use a custom object that has two parameters, there are 400 object 
instantiations in aciton class. Put this one in ActionForm. This table is just 
a part of the entire display thing. 
 
What do you think is the best route to take? I feel that custom object thing 
goes with the logic. But, I am afraid of performance.
 
Thanks again.....
 
 
 


Craig McClanahan <[EMAIL PROTECTED]> wrote:
On 8/30/05, peru cheppanu wrote:
> 
> Thanks for replying me.
> 
> The basic idea is knowing the need for tag libraries.. for which the 
> explanation was given as reusability.
> 
> Now, coming to specific example I have given:
> 
> I agree that it should not be a part of logic: library. But, I think one 
> such tag (substring) is useful in some cases.
> 
> Say I need to populate a 40 * 10 table with two variables in each cell. I 
> will need a object array of size 400 with two parameters in it. ( I can have 
> Hashmap if I have identical keys, but say thats not the case either). 
> Instead I can have 400 String objects sent with some delimeter. I will save 
> lot of object instantiations and substring the ones with two params. What do 
> you think?



Quite frankly, I think this particular case is worrying about the wrong 
problem entirely.

The focus during app development should be on creating simple logic that 
gets the job done, and is easy to modify later because it is clearly 
structured. *Only* if you have performance issues related to CPU time on the 
middle tier where your servlet container is running will issues like object 
instantiations versus substringing matter -- and, even if that matters, I 
doubt that one solution will be particularly better than the other, because 
both have tradeoffs.

But, you should really be focusing on figuring out what makes for a clean, 
understandable architecture for the entire app, and how to make sure that, 
over the long term, it can be maintained and enhanced. And, I would focus on 
writing logic that is relevant to your application, rather than 
infrastructure things like new tags, until you can demonstrate a need for 
reusable code that can't easily be met without extending the underlying 
framework. (And, even there, I would look for other tag libraries *before* 
trying to invent my own ... do not be limited in thinking that you can't 
combine tag libraries from multiple sources in a Struts app. Your value to 
your company is the unique knowledge you have about *your* application 
requirements.


Craig McClanahan


Radu Badita wrote:
> 
> Although the previous two answers are basically correct, I don't think
> they really contain the response to Peru's initial question. I hope that
> the "elders" of this list will clarify things a bit for him. :-)
> I considered that I'd better avoid responding myself to this, as one
> that sometime ago was asking (myself and others) why should using the
> or be better than using the equivalent
> java code - which was also faster for me to do than learning the new
> tags....
> Still... In this specific case, maybe the answer is not writing a whole
> new custom tag at all. It wouldn't be very efficient anyway, especially
> if the "parsing" mentioned is done in one or two particular places only.
> It might show that maybe a model layer does not exist for the
> application, and maybe the data is directly retrieved from a (probably
> legacy) database. (Forgive me if I'm wrong.) At least that parsing could
> be done in the Action that prepares the view, and the data stored in a
> form that is easier to display.
> Even if you will still chose to use a custom tag for that, attaching it
> to the struts standard "logic" taglib wouldn't be a good choice ( if
> that was what you meant by a tag used as
> 
> )
> 
> Radu
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> ---------------------------------
> Start your day with Yahoo! - make it your home page
>

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to