• Post Reply Bookmark Topic Watch Topic
  • New Topic

which one is better in terms of performance  RSS feed

 
Ashik Uzzaman
Ranch Hand
Posts: 2373
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose we have 5 distinct buttons in an UI all of which can generate events. In such case we can ---
(1) keep 5 distinct action listener objects to react in 5 different ways when different buttons are pressed. Or,
(2) keep one action listener object for those 5 buttons to react in 5 different ways through identifying which button was pressed in runtime (may be through getActionCommand() or some other means).
Options (1) has an overhead of creating 5 listener objects while option (2) has overhead of runtime calculation of identifying the specific object requersting for an action.
Which option do you think is better in terms of performance, maintainance, scalability or some other importnant features in Java.
Your opines pals? :roll:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!