accessor for variables in AbstractAction subclass

Discussion in 'Java' started by -, Jul 1, 2005.

  1. -

    - Guest

    Is it bad design to have get/set in a AbstractAction subclass? Or
    should there only be the actionPerformed method?
     
    -, Jul 1, 2005
    #1
    1. Advertising

  2. On Fri, 01 Jul 2005 14:34:52 +0800, - wrote:

    > 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

    --
    You can't run away forever,
    But there's nothing wrong with getting a good head start.
    --- Jim Steinman, "Rock and Roll Dreams Come Through"
     
    Stefan Schulz, Jul 1, 2005
    #2
    1. Advertising

  3. -

    Chris Smith Guest

    - <> wrote:
    > 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
     
    Chris Smith, Jul 1, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QmlsbCBCb3Jn?=

    Need "get" accessor to return property name

    =?Utf-8?B?QmlsbCBCb3Jn?=, Oct 26, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    419
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Oct 26, 2004
  2. jstorta
    Replies:
    3
    Views:
    477
    jstorta
    Feb 20, 2006
  3. S.Volkov
    Replies:
    2
    Views:
    244
    S.Volkov
    Mar 12, 2006
  4. Trans
    Replies:
    8
    Views:
    354
    Robert Klemme
    Oct 23, 2008
  5. Fab

    Subclass of subclass

    Fab, Aug 9, 2012, in forum: C++
    Replies:
    0
    Views:
    417
Loading...

Share This Page