accessor for variables in AbstractAction subclass

?

-

Is it bad design to have get/set in a AbstractAction subclass? Or
should there only be the actionPerformed method?
 
S

Stefan Schulz

Is it bad design to have get/set in a AbstractAction subclass? Or
should there only be the actionPerformed method?

IMHO, it depends. If these getters and setters are rather tightly tied to
the action to be performed, then i guess it is ok. If, however, you find
yourself with a full-fledged object that just happens to have an
actionPerformed method, you might want to move this method to an inner
class, and expose it through some method only
 
C

Chris Smith

- said:
Is it bad design to have get/set in a AbstractAction subclass? Or
should there only be the actionPerformed method?

This depends entirely on your application code. There's certainly no
global rule (or even rule of thumb) preventing your AbstractAction
subclasses from implementing additional functionality. Of course, if
that functionality isn't related to the class's abstraction, then it
would be a bad idea. If the functionality is related, then adding
appropriate methods there is good design.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top