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

Applying Simple Design to Complex Legacy Code

Expand Messages
  • schnablebg
    Sometimes when you are working on legacy code, a simple solution to a problem does not fit well within an overly complex existing framework. I have encountered
    Message 1 of 3 , Sep 7 6:45 AM
      Sometimes when you are working on legacy code, a simple solution to a
      problem does not fit well within an overly complex existing framework.
      I have encountered this mainly when extending existing functionality.
      For example, to add a new feature in line with existing code would
      require touching 4 modules whereas a new, simpler design would require
      its own module but introduce integration concerns. There seems to be
      a tradeoff between extending the old code so the design remains
      homogenous and retains the same "feel," and adding a new module that
      may duplicate some existing functionality. I should note that in my
      project, serious refactoring is not possible at this time due to the
      nature of the codebase. (If you don't believe me I have two words for
      you: ASP and VBScript.)

      Does anyone have any thoughts on this?


      Ben
    • Adrian Howard
      ... [snip] ... Go buy Working Effectively with Legacy Code by Michael Feathers :-) Worth every penny. Adrian
      Message 2 of 3 , Sep 7 7:53 AM
        On 7 Sep 2006, at 14:45, schnablebg wrote:

        > Sometimes when you are working on legacy code, a simple solution to a
        > problem does not fit well within an overly complex existing framework.
        [snip]
        > Does anyone have any thoughts on this?

        Go buy "Working Effectively with Legacy Code" by Michael Feathers :-)

        Worth every penny.

        Adrian
      • Robert Hanson
        I take it there are no unit tests in the 4 modules that would require modification. Can you use sprout method ? Michael Feathers uses this to inject new
        Message 3 of 3 , Sep 7 7:54 AM
          I take it there are no unit tests in the 4 modules that would require
          modification.



          Can you use "sprout method" ? Michael Feathers uses this to inject new
          behavior into existing code.
          http://safari.oreilly.com/0131177052/part02 This lets you add unit
          tests for the new code without needing to worry about breaking old code.



          Otherwise, I'd say add the new module complete with unit tests. Because
          you're duplicating functionality, you may find that you can change the
          legacy code to call your new methods. This would help bring some
          portion of the legacy code under test.



          Have you looked at Model-View-Presenter? That may help as well, by
          isolating the business logic from the view/web page.







          ________________________________

          From: extremeprogramming@yahoogroups.com
          [mailto:extremeprogramming@yahoogroups.com] On Behalf Of schnablebg
          Sent: Thursday, September 07, 2006 8:45 AM
          To: extremeprogramming@yahoogroups.com
          Subject: [XP] Applying Simple Design to Complex Legacy Code



          Sometimes when you are working on legacy code, a simple solution to a
          problem does not fit well within an overly complex existing framework.
          I have encountered this mainly when extending existing functionality.
          For example, to add a new feature in line with existing code would
          require touching 4 modules whereas a new, simpler design would require
          its own module but introduce integration concerns. There seems to be
          a tradeoff between extending the old code so the design remains
          homogenous and retains the same "feel," and adding a new module that
          may duplicate some existing functionality. I should note that in my
          project, serious refactoring is not possible at this time due to the
          nature of the codebase. (If you don't believe me I have two words for
          you: ASP and VBScript.)

          Does anyone have any thoughts on this?

          Ben





          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.