• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

which one is better in terms of performance

 
Ranch Hand
Posts: 2378
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Crusading Chameleon likes the size of this ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic