Another vote here for "Working Effectively with Legacy Code"
On Jan 14, 2007, at 10:35 AM, Michael G Schwern wrote:
>
> ... (where's my refactoring browser!?)
http://e-p-i-c.sourceforge.net/
Eclipse plugin for Perl. Provides "extract subroutine" using
Devel::Refactor.
I believe Jeff Thalhammer is working on adding perl::Critic support
to EPIC as well.
> At absolute minimum, with a big ball of mud, you can do dumb high
> level "exact input/output" tests of the sort which would normally
> be frowned upon.
Yes, and, you need not stop at "exact" input/output.
Putting automated end-to-end tests in place can indeed cover a good
deal of the code - these would be tests that could also be called
"acceptance" or "integration" tests. Using the web app example:
- login
- attempt login with bad credentials (should fail)
- Add item to shopping cart.
- Remove item from cart
Etc.
You can run many of these tests every 5 minutes all day, every day,
and use them under something like Nagios or NetSaint, etc. as part of
a monitoring system.
More about balls o'mud:
- Add "seams" as described in "Working Effectively with Legacy Code."
Seams are places in the code where you can alter its behavior without
editing at that place (once the seam is on.) For example, replacing
an expression like ( $dollars .. $donuts ) with a subroutine call:
Utils->get_range_of_items($dollars,$donuts) means you can now makes
changes in get_range_of_items() which could be in a seperate (well
tested) class.
Perhaps the most interesting area (to me) about balls o'mud is the
question of how to decide what refactorings and improvements are
worth the effort. On a big ball o' mud this is a very hard problem.
It requires that one:
1. Estimate the effort/cost of a refactoring/improvement.
and
2. Estimate the value of a refactoring/improvement.
Since the ball o' mud is, by definition, hard to understand, these
estimates are even harder than usual.
-------------------------------------------------------
Matisse Enzer <matisse@matisse.net>
http://www.matisse.net/ - http://www.eigenstate.net/
Thread Previous
|
Thread Next