View Full Version : Purging Redundant Code


DreamGenius
11-26-2008, 01:00 AM
This is a housekeeping challenge. I've inherited a few databases lately, for different customers, that I'm developing in accordance with the customers' requirements as opposed to the original developer's desires.

As a consequence, and I'm not saying I'm better or even right, I find I'm doing things differently. Changing forms is rendering whole areas of code redundant, removal of which would tidy up the databases dramatically.

The question then is this; is there an easy or a simple way of locating and purging redundant code. Alternatively, is there a development methodology which will minimise the occurence of this.

gemma-the-husky
11-26-2008, 05:41 AM
really hard, i think,

i tend to leave it, as i hate deleting stuff

often i rename original forms as z_formname, copy them, and then edit the amended copy.

in a year or so, if you didnt need the old stuff, then delete it

fredalina
11-26-2008, 05:57 AM
A compile test will show you orphan code. That's as far as i've been able to get, i'm afraid. i will keep an eye out for the answers, though, as i'm in a similar situation.

DreamGenius
11-26-2008, 06:38 AM
A compile test will show you orphan code.Can you expand on this please? I don't really know what you're refering to.

fredalina
11-26-2008, 06:52 AM
Um, in any code window, go to Debug in the menu bar and select Compile (database). It will run through and show you any errors, including orphan code. Orphan code for example if the original form had a combo box that you have changed to a list box and changed the name of. Any code associated with the combo box will throw up an error and you will be able to track down that code to ensure it's truly not needed. It will also give you other compile errors like variables not defined, etc, so you can't just go through and delete any code that errors, but it's a start.

I'm a beginner, too, but i've found this to be useful anyway.

fredalina
11-26-2008, 06:54 AM
P.S. i tend to comment out this code before deleting it to make sure it's just not needed. i'm a packrat by nature and i hate deleting things and then finding out they were vital. i also copy the code into Word and save it before finally deleting it, so i can copy/paste it back in later should i need it after all.