Loading ...
Sorry, an error occurred while loading the content.

Re: Refactoring Combo: Extract Command

Expand Messages
  • Anthony Williams
    ... Martin Fowler calls this Replace Method with Method Object in the Refactoring book. ... Nice, clear walkthrough. Anthony -- Anthony Williams Software
    Message 1 of 2 , Dec 5, 2005
    • 0 Attachment
      Alex Chaffee <alexch@...> writes:

      > Let's say you've got a big class with a lot of methods -- a dispatcher
      > or controller, say, that's gotten a bit out of control. The methods
      > are real business methods (or at least they have business logic inside
      > them), but they refer to several different entities, so you're not
      > sure they belong on any given entity. But you want to get them out of
      > the original class and into domain classes.
      >
      > Sounds like it might be time for a Command Pattern.
      >
      > Usually a Command is used when you want to encapsulate the doing of
      > something, without actually doing it right away. But in this case,
      > we'll execute it immediately.

      Martin Fowler calls this "Replace Method with Method Object" in the
      Refactoring book.

      > http://www.purpletech.com/content/index.php?itemid=22
      >
      > In this article, I walk through the precise sequence of steps to
      > perform this refactoring in IntelliJ IDEA (version 5). There are some
      > pretty fun keystroke combos you can use to make the whole thing
      > relatively painless and automated.

      Nice, clear walkthrough.

      Anthony
      --
      Anthony Williams
      Software Developer
      Just Software Solutions Ltd
      http://www.justsoftwaresolutions.co.uk
    Your message has been successfully submitted and would be delivered to recipients shortly.