[Pdx-pm] Converting a monolithic program to mvc

Michael G Schwern schwern at pobox.com
Mon Jun 14 20:58:32 PDT 2010


On 2010.6.10 11:17 AM, Phred Bob wrote:
> I am trying to take a monolithic perl program (approx. 97k lines long)
> and separate concerns (kind of an MVC-style division). I used *AutoSplit
> *to break out the subroutines, but now I'm stuck. I tried separating the
> *.al subroutines into a View directory if they contained a print
> statement and into a Model directory if they didn't. The main part of
> the program (before __END__) is about 4.6k lines that I am tentatively
> making the Controller.

I would recommend against adding AutoSplit into the mix.  It doesn't really
have anything to do with making a program MVC and it just complicates things.
 All it (might) do is speed up load time, but you can solve that with FastCGI
or something (assuming its a web program).

Calling everything with a print statement a "view" and everything else a
"model" isn't particularly useful.  I'd advice against trying to cram your
program into the MVC paradigm, it sounds like its quiet a few steps away from
that.  You need to start with something more basic.

Without seeing the code, what I can say is "find the seams".  Look for
sections of code or groups of routines that go together and try to make a
class or object or even a library out of them.  Sorry I can't be more specific.


-- 
But there's no sense crying over every mistake.
You just keep on trying till you run out of cake.
    -- Jonathan Coulton, "Still Alive"


More information about the Pdx-pm-list mailing list