I have a task on me
to move (we call it "port") some test code from one location to another. The details are not interesting, but it did
involve moving a test "Shape" object and a "Text" object.
The text object and
the shape object both inherited from the same parent class, included the same
set of header files, were co-located in the same directory within the project I
wanted to modify and were otherwise similar in structure. For a variety of reasons, though, the text
object could be moved without much effort at all. The shape object proved far more difficult.
At first, the
compiler complained it could not find the header file for shape.h. That was a little tricky, but it boiled down
to having 2 files named shape.h in the project, and the path to the file I
wanted was not specified correctly.
Fixing that caused the shape object not to be able to inherit from its
parent class.
And thus began about
2 weeks of trying to get the darn code to build. I would find and fix one problem only to get
to the next error. This is not unusual -
we call it peeling the onion - but it is time consuming.
For my needs, this
is a medium priority task at best, so I wasn't working on it full time. Just when I could fit it into my schedule for
an hour or so. I started with 27 build errors,
built that up to about 100, then whittled it all down to 2.
But at this point I
was 2 weeks into build files, linking errors, etc… and decided to try a new
approach since I felt I was treating symptoms and not the underlying problem.
I put everything
back where it was (reverted my changes, so to speak) and rebuilt. I then stepped through the code to see how
the Shape object was being allocated and used.
It wasn't.
Although it is
referenced in the tests, it was never used.
It was dead code.
Sigh.
I was able to delete
the dead code, move everything else I needed and got unblocked.
Lesson learned - do
your investigation early in the process to determine what actually needs to be
ported!
Now, off to a 2 week
hiatus. See you when I am back!
Questions, comments,
concerns and criticisms always welcome,
John