Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: general advice finding duplicate code

by Anonymous Monk
on Jun 21, 2011 at 05:55 UTC ( [id://910683]=note: print w/replies, xml ) Need Help??


in reply to general advice finding duplicate code

to now manually unravel the duplication by hand

This is a classic refactoring problem. The amount of duplication doesn't matter, you simply go file by file, and re-write each file to be modular, using the appropriate amount of abstraction.

By the time you're on file 20 (of 500), you'll know if possible (and worth the effort ) to refactor all 55k lines of code, or start from scratch.

If this were perl, I would say use B::Xref to generate a graph, and then look for cycles ...

Or if the code is at all modular, use autodia and/or GraphViz::ISA to get a picture

surely php has something similar, maybe :)

  • Comment on Re: general advice finding duplicate code

Replies are listed 'Best First'.
Re^2: general advice finding duplicate code
by armstd (Friar) on Jun 22, 2011 at 04:47 UTC

    I gotta agree with this one. 55k LOC really isn't that much. If you have a duplication problem, you probably have a factoring problem.

    Refactoring the code will not only help eliminate your duplication issue, but will also teach you what the code is doing, and result in a much better end result than simply eliminating duplication.

    Eliminating the trivial copy/pastes is a good start though, anything that helps maintainability will buy time for refactoring, helping others avoid making the problem worse while you race to make it better.

    --Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://910683]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-19 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found