Spaghetti coding, or copypasta are good cooking, but programming bad practice. 

Another bad practice is the abuse of properties:

  for i := 0 to MyComp.Other.Array.Count-1 do
    for j := 0 to MyComp.Other.Array[i].List.Count-1 do
    begin
      MyComp.Other.Array[i].List[j].Prop := MyComp.Other.Array[i].List[0].Prop;
      MyComp.Other.Array[i].List[j].Prop2 := MyComp.Other.Array[i].List[j].Prop;
    end;

By using some local variables, or even the "with" keyword (with caution) code could be much easier to read and faster to execute.

Another awful problem, due to the RAD approach of Delphi, is the mixing of UI, database and logic in some quick-written applications. UI components are used to store data. UI components are used to manage data. And so... Quick to write. Hell to maintain! I really love the MVC or multi-tier architecture.

So let's stop weeping.

Here are perhaps some advices:

1) Don't get frustrated. You didn't write this.

2) Don't blame the one how wrote this. Remember your first program. Remember the first code you wrote in a new language.

3) Make some sport, play music, mow, or whatever: I'm running miles and miles, just to let the bad code pressure go away.  ;)

4) Don't start modifying the code. Since I guess there is no unitary testing, you could introduce regressions. Sometimes, there is some border effect which makes the application run...

5) First read, read, read, take a breath and read again. Try to guess how it works. If there is some technical documentation (but I'm quite sure there is none), try to find it, even if it's a deprecated old version. Take a pen and write diagrams, make a to-do list.

6) For the first modifications/fixes to introduce, try to use existing functions or classes. Add some methods.

7) But don't continue using globals, spaghetti code, copypasta and such in your code.

8) Comment your modifications inside the code.

9) Use some reverse-engineering tool, like our open source SynProject which is able to parse the units and retrieve some logic.

9) If you can modify heavily the code (if you are the only programmer, and you don't rely on a locking SCM), add comments to existing code, as you're writing it.

10) If you can't modify the code, use external comments (we introduced it in our SynProject utility).

11) Write external documentation about what you did, which units you modified, and such. There is so many info to remember when you discover such a big application. Don't trust your memory, even for what you're writing. Start documenting everything.

12) The time you're spending commenting and documenting now will help you later. It's no wasted time. Whatever the project manager is telling you.

13) Try to figure out how you could make it better, changing the architecture into multi-tier, and so on.

14) After some successful fixes, try to get the green light to start a rewriting of the application. You can reuse some part of the existing code, but rely on "cleaner" approach, like ORM or MVC. 

15) If you're cleared to rewrite the application, don't change to DotNet or Java. You can do anything in Delphi.

Feedback and comments are welcome on our forum!