Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8100549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:45:40+00:00 2026-06-05T22:45:40+00:00

I have a large codebase which I am working with which has units like

  • 0

I have a large codebase which I am working with which has units like this:

unit myformunit;

interface
type
  TMyForm = class(Form)
  end;

  procedure not_a_method1;

  procedure not_a_method2;

  var
     global1,global2,global3:Integer;
  ...

In short, the authors of the code did not write methods, they wrote global procedures. There are tens of thousands of them. Inside these procedures, they reference a single instance of MyForm:TMyForm.

I am considering writing a parser/rewriter utility that will turn this code into “at least minimally object oriented code”. The strategy is to move the interface and implementation section globals into the form, as a start. I realize that’s hardly elegant OOP. But it’s a step forward from globals.

If I could do this on one unit at a time, I might be able to repair the breakage in the rest of the project, if I only did it on one form at a time. But I’d like to reduce the amount of time it takes to rewrite the units, instead of doing it by hand. Some forms have 500+ procedures and 500+ interface and implementation global variables which are in fact, specific to the state of a single instance of the form that they are in the same unit with.

Basically, what I will do if nothing like this exists is write a parser based on the Castalia Delphi parser. I’m hoping that perhaps ModelMakerCodeExplorer, or castalia, or some other similar tool has something that would at least do part of what I need for me, so I don’t have to build this utility myself. Even if I do have to build it myself, I estimate it might automate about a thousand to two thousand hours of grunt-work for me. I can at least run it, and then see how much breaks, and then revert or commit after I’ve decided on a level of effort to refactor this code.

Alternative strategies that accomplish the same goal (go from zero encapsulation and zero OOP, to more encapsulation, and slightly more than zero OOP, in an incremental way, on a large, unstructured delphi codebase that only used objects when it was unavoidable, and never had any idea about real OOP) are welcomed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:45:41+00:00Added an answer on June 5, 2026 at 10:45 pm

    Changing the globals to form fields seems like just cut and paste them. You might consider moving them in a dummy procedure and use MMX to normalize the declarations first.

    Then use ModelMaker Code Explorer to move the procedures and functions into the form, which is only just cut and paste in the Member View.

    Not necessary, but as a next step remove the references to the form instance from the method bodies. This can be achieved by find and replace.

    Or did I miss something?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large codebase which has many, many instances of the try {
Following up on this question, I'm working on a large Delphi 7 codebase which
I'm working on some large Catalyst codebase which doesn't have a seperate config file.
I'm working on a large SQL Server codebase, some of which has been in
I have a large C codebase for which I had to generate Call graphs.
I have a large codebase that uses Systems Hungarian for most variable names, which
I have a large-ish codebase which builds several dozen libaries and several executables. The
We have a very large app which has been designed exclusively by a single
I have a large codebase, and I'd like to refactor the package structure so
I have large codebase written in HSP ( wikipedia article - think BASIC, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.