Kristian Rink | 21 Jun 2011 13:23

real-world architectural refactoring in a dirty environment?

Folks;

hoping not to be all too off-topic with this here, I am looking for
some fundamental insight in how others do architectural refactoring on
a semi-large scale. Here's the situation:

* Most of our business logic lives as customizing code inside a
  document management system. The amount of code in there has
  accumulated throughout the last 8 .. 10 years, most of the time being
  implemented in "quick hacks" to tickle a very specific customer need.

* There is no substantial data model or architecture. Most of the
  customizing code is rather tightly coupled to / woven into the
  infrastructural aspects dictated by the document management system.

* The system itself is built on top of a proprietary programming
  language which just exists inside this very system. There is no
  development, monitoring, testing, deployment, administration tooling
  support at hand. 

* The platform, as is, has no notion of an "external API" or support
  for _any_ kind of interface technology you might want to use. There
  is very crippled CORBA support (unusable to solve real-world
  problems), there is very crippled SOAP support, and there is next to
  no support for even things as fundamental as writing schema-validable
  XML. The only way of making this thing appear inside of a more
  "up-to-date" environment is a hand-crafted (and thoroughly buggy,
  thanks to the limitations of the language usable for that)
  HTTP-GET/POST structure transferring something akin to "JSON lite". 

(Continue reading)

Donaldson, John (GEO | 21 Jun 2011 15:56
Picon
Favicon

RE: real-world architectural refactoring in a dirty environment?

Kristian,

Did you read "Working Effectively with Legacy Code" by Michael Feathers? If not, it will be worth the investment.

Apart from that, you can't really refactor much or well or confidently until you have some tests. So try to
start by selecting a simple, small problem and put in place a couple of tests and then refactor. Then just
keep taking small bites.

Of course, you may need to refactor a little bit in the dark to begin with, just to get a testable piece of the application.

John D.

-----Original Message-----
From: refactoring <at> yahoogroups.com [mailto:refactoring <at> yahoogroups.com] On Behalf Of Kristian Rink
Sent: 21 June 2011 13:23
To: refactoring <at> yahoogroups.com
Subject: [refactoring] real-world architectural refactoring in a dirty environment?

Folks;

hoping not to be all too off-topic with this here, I am looking for
some fundamental insight in how others do architectural refactoring on
a semi-large scale. Here's the situation:

* Most of our business logic lives as customizing code inside a
  document management system. The amount of code in there has
  accumulated throughout the last 8 .. 10 years, most of the time being
  implemented in "quick hacks" to tickle a very specific customer need.

* There is no substantial data model or architecture. Most of the
(Continue reading)

Steven Gordon | 21 Jun 2011 16:54
Picon

Re: real-world architectural refactoring in a dirty environment?

Starting with unit tests (tests which verify that individual
methods/object/components do a specific thing correctly) is nearly
impossible when you have a bowl of spaghetti instead of nicely layered
lasagna.

It probably makes sense to start with functional tests (test that verify
specific behaviors of the entire software).  Then, as you attempt to
refactor the software into decoupled components, you have a reasonable way
to verify that the software as a whole still does what it is supposed to do.

Once you have decomposed the software into decoupled components, then you
are in a position to work on each individual component (in priority order)
at a lower level of detail in order to drive down to the point where unit
testing becomes feasible.

This can take a long time, but usually less time than a total rewrite.  And
the components that prove to be stable can be left alone (possibly forever).

Even if you choose to rewrite, using functional tests to decompose into
components allows one to rewrite one component at a time and get value from
each rewrite by replacing the legacy version of the component with the
rewritten one (whereas a rewrite from scratch provides no value until
everything has been rewritten).

A hybrid approach is also feasible where the worst components are rewritten,
the mediocre ones are refactored, and the stable ones left alone.

My advice is to start with functional tests.  Doing so will probably
discover lots of previously unknown bugs.

(Continue reading)

George Dinwiddie | 21 Jun 2011 17:16
Favicon

Re: real-world architectural refactoring in a dirty environment?

Kristian,

In addition to Feathers' Working Effectively with Legacy Code, take a 
look at Ellnestam and Brolund's Mikado Method 
(http://mikadomethod.wordpress.com/book/). The two complement each other 
well.

On 6/21/11 7:23 AM, Kristian Rink wrote:
> Folks;
>
> hoping not to be all too off-topic with this here, I am looking for
> some fundamental insight in how others do architectural refactoring on
> a semi-large scale. Here's the situation:
>
> * Most of our business logic lives as customizing code inside a
>    document management system. The amount of code in there has
>    accumulated throughout the last 8 .. 10 years, most of the time being
>    implemented in "quick hacks" to tickle a very specific customer need.
>
> * There is no substantial data model or architecture. Most of the
>    customizing code is rather tightly coupled to / woven into the
>    infrastructural aspects dictated by the document management system.
>
> * The system itself is built on top of a proprietary programming
>    language which just exists inside this very system. There is no
>    development, monitoring, testing, deployment, administration tooling
>    support at hand.
>
> * The platform, as is, has no notion of an "external API" or support
>    for _any_ kind of interface technology you might want to use. There
(Continue reading)

John Roth | 21 Jun 2011 17:27
Picon

Re: real-world architectural refactoring in a dirty environment?

You might find this comment from Martin Fowler's bliki interesting:

http://martinfowler.com/bliki/StranglerApplication.

John Roth

On 6/21/11 5:23 AM, Kristian Rink wrote:
>
> Folks;
>
> hoping not to be all too off-topic with this here, I am looking for
> some fundamental insight in how others do architectural refactoring on
> a semi-large scale. Here's the situation:
>
> * Most of our business logic lives as customizing code inside a
> document management system. The amount of code in there has
> accumulated throughout the last 8 .. 10 years, most of the time being
> implemented in "quick hacks" to tickle a very specific customer need.
>
> * There is no substantial data model or architecture. Most of the
> customizing code is rather tightly coupled to / woven into the
> infrastructural aspects dictated by the document management system.
>
> * The system itself is built on top of a proprietary programming
> language which just exists inside this very system. There is no
> development, monitoring, testing, deployment, administration tooling
> support at hand.
>
> * The platform, as is, has no notion of an "external API" or support
> for _any_ kind of interface technology you might want to use. There
(Continue reading)

Matthew Smith | 21 Jun 2011 20:05
Picon

RE: real-world architectural refactoring in a dirty environment?

That should be http://martinfowler.com/bliki/StranglerApplication.html

From: refactoring <at> yahoogroups.com [mailto:refactoring <at> yahoogroups.com] On
Behalf Of John Roth
Sent: Tuesday, June 21, 2011 11:27 AM
To: refactoring <at> yahoogroups.com
Subject: Re: [refactoring] real-world architectural refactoring in a dirty
environment?

You might find this comment from Martin Fowler's bliki interesting:

http://martinfowler.com/bliki/StranglerApplication.

John Roth

On 6/21/11 5:23 AM, Kristian Rink wrote:
>
> Folks;
>
> hoping not to be all too off-topic with this here, I am looking for
> some fundamental insight in how others do architectural refactoring on
> a semi-large scale. Here's the situation:
>
> * Most of our business logic lives as customizing code inside a
> document management system. The amount of code in there has
> accumulated throughout the last 8 .. 10 years, most of the time being
> implemented in "quick hacks" to tickle a very specific customer need.
>
> * There is no substantial data model or architecture. Most of the
> customizing code is rather tightly coupled to / woven into the
(Continue reading)

Kristian Rink | 24 Jun 2011 08:42

Re: real-world architectural refactoring in a dirty environment?

Folks;

first off, thanks very much for your interesting insights and thoughts
on that. To add a few comments:

> That should be http://martinfowler.com/bliki/StranglerApplication.html

Yes, I already stumbled across this a while ago, and I also dealt with
the WELC book for quite a while, all along with Fowlers Refactoring
book, the Clean Code Handbook and the Elephant / brownfield book. All
these, though particularly useful and rather interesting in terms of
learning and improving, so far left me with a couple of questions I
eventually lack experience to really deal with (the difference between
"knowing from books" and "knowing from having done a dozen times
before"):

- Starting with WELC, most of the approaches are obviously built around
  the idea of building a skeleton of reliable (functional, unit, ...)
  tests to refactor without putting the whole mess at risk.
  Unfortunately, in our environment, most of the core logic is
  implemented in a technology / language which, apart for a half-baked
  unit test framework that doesn't work right, doesn't have useful
  support for any kind of testing. So, doing functional testing almost
  immediately will end up building some sort of external logic and
  somehow attach this to the backend system, which is difficult because
  there is no real interface technology to do so. So, in order to do
  meaningful functional tests in any way will require a drastic amount
  of work and a bunch of fragile code which always will be prone to
  failure. I am not sure whether this is really helpful.

(Continue reading)

Willem Bogaerts | 12 Jul 2011 16:45
Picon
Favicon

Re: real-world architectural refactoring in a dirty environment?

A bit late perhaps, but "I have this pattern":
http://www.xpnl.org/Wiki/HowToRideADinosaur.html

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/refactoring/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/refactoring/join
    (Yahoo! ID required)

<*> To change settings via email:
    refactoring-digest <at> yahoogroups.com 
    refactoring-fullfeatured <at> yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    refactoring-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/


Gmane