in reply to general advice finding duplicate code

As we all know, probably the most annoying aspect of these problems is that the various “duplicated” bits of code are often not quite the same.

PHP’s biggest weakness, in my opinion, is also a fundamental aspect of its design:   “code and data are intermingled.”   Logic is scattered willy-and-yon among the presentation and is usually completely governed by it.   I have turned a lot of PHP modules into Template::Toolkit files, but it was never, ever easy.   You basically are re-writing the damn thing . . . basically, from scratch.   But sometimes you just can’t make a silk purse.

Replies are listed 'Best First'.
Re^2: general advice finding duplicate code
by aquarium (Curate) on Nov 10, 2011 at 22:32 UTC
    Oh wise monks. The five months since initially posting this I've learn a lot, but not achieved that much. Past the very few instances where multiple copies of code could be centralised, it turns out there's too many design flaws in this behemoth of an application. Upon further inspection there is an unwieldy spider web of possible calls and entry points between the scripts, the use of the wrong data structure and mixing of code, data, and presentation. For any little challenging situation, yet another additional url variable was invented. It's a right, royal mess. Any meaningful further fixes all seem to lead to basically a complete rewrite. To top it off, the self taught programming author of the app is still keeping his fingers in the pie. Often negating any useful fix by unfounded fear arguments against specific fix. So i've resigned myself to putting in less effort into this, as i can see it doesn't deserve all my attention. When it does fall over, I won't take it too seriously...even though the app is used by select few, instead of the masses. i'm now spending at least some time in desktop publishing and info-graphics. There's potential for programmers to follow some of Edward Tufte's ideas when generating data graphics.
    the hardest line to type correctly is: stty erase ^H

      Pity

      Be sure to document these issues (both social and technical), and how you would re-[architecture the program, and use them as a valuable field experience (also CYA)

      Also, keeping your spirits up is very important, good to figure this out sooner

      De-stress early, de-stress often