Cleaning Code

I am a software developer of a certain age and have maintained a practice, throughout the many years of coding that I have enjoyed, of “commenting out” code that I have modified whenever making revisions to the source code.

That engenders a minor issue in “bloating” the overall size of the code base and I accept that as a minor “cost” to maintain the degree of visibility that I have in relation to my historic coding revisions.

Over time, however I have reached a point where a project that I have had in continuous development from my early foray into Xojo (late 2015) probably should have some housekeeping undertaken.

Manual “cleansing” of the relevant code for all Desktop Windows (50+), Classes (40+) and Modules in the project represents a relatively boring task that would undoubtedly take up more of my time than I would like so I have developed the code to process base Xojo files (xojo_window and xojo_xml_code) and remove that “bloated” content.

I intended to manage the replacement of cleansed code using my own application facilities to archive the original Xojo base files with the cleansed versions but this causes a problem when opening the project following that activity.

My initial testing established that an external Class subject to that revision is not identified as such but reverts to being identified as a Module with no visible methods.

I presume this may be a consequence of some “internal Xojo” checking (perhaps related to the xojo_project file content) and am seeking any advice that might be offered to assist me in achieving the “automation” of the task I am seeking to undertake.

Any feeedback would be welcome.

Are you using version control such as git? And are you saving your Xojo projects in the text or xml format?

Because if so, it is then relatively easy to see the “diff” between your code cleansing before and after.

The “diff” could then point you at code (or other internal proprietary information of the project) that was removed or altered during the cleansing process, and what is likely the source of your problem.

No, I am not using git and components of the project are stored in both text and xml format.

The “diff” between different version/files is visible to me via my own “application”.

The observation I am making is related to replacement of “bloated” file.xojo_xml_code with a revised “cleansed” version of file.xojo_xml_code that I “create” through my automated “cleansing” of the former (i.e. the original “bloated” file.xojo_xml_code being “automatically” replaced by the latter).

I’m confused. Are you making an “observation” or do you have a problem with your code and asking for help?

Because it sounds like you have a problem, which your custom made “diff” is not showing you. I suspect your cleansing routine is likely changing or removing some internal proprietary data that the Xojo IDE requires.

Do you have access to a stand-alone diff tool? If so, then I would open a before and after version of one of your problem files in an actual diff tool and see what can be seen.

Note: Xojo does not recommend users altering project files outside of the IDE.

Appreciate your interest and understand you may be confused.

I am making an observation in relation to perhaps an “unrecommended” activity.

Maybe best if I await any feedback from those who might be able to offer an insight to that arguably rash course of action on my part - hopefully a member of the Xojo team.

May have been equally rash in posting on the forum and perhaps should have pursued it with Xojo team directly and personally.

Anyway, thanks again for your contribution and trust my reply reduces the level of confusion.