What is reusable code? Is it a template to base projects on or single piece of code used in multiple programs? Microsoft seems confused.
So how does this discussion of software reuse relate to Visual C++ Express? When I was developing the software for the vector class, I created a project that included the files Vectors and SimpleVec (cpp and h). These files grew and evolved as the project went forward. At first, all these files were in the main project directory, but eventually I created a library folder for them, which is intended to become the modernized version of my desk drawer.
When I started the development of the matrix class, I created a new project, which included the same files (you can see where this is going, right?). As this project evolved, I found that I needed to make changes to the vector-related files. That worked--no problem.
Then I went back to run the vector project again. I discovered, to my horror, that it was now broken. VC++ Express was telling me that the files were corrupted, so it wouldn't even open the project. If it had, perhaps I could have repaired the damage somehow, but I couldn't.
What's up with that? What good is software reuse if you can't actually reuse the software?
I can't tell you what happened--I need a Microsoft guru for that--but I do have a theory. When you're working with a given VC++ Express project, I gather that it retains info on the files in a given project, which it uses to rebuild it as needed. When I made changes to some file in the second project, the date and size info on that file didn't match what the first project had remembered. So VC++ concluded that the project was broken.
Many Windows applications--Visual SlickEdit and the Matlab editor, for example--easily detect files that have been changed and politely ask you if you want to revert to an older version. Apparently, VC++ Express does not.
I can't say that I've done an exhaustive study of this issue--yet--but I did talk to a few folks in the Microsoft developers' community, from both the online help forums and newsgroups. Without exception, the folks who responded all said that they'd never tried to use files in the way I had. Whenever they "reuse" files, they make new copies in the new project folder.
That path leads to disaster, because you end up with multiple copies of a given file--copies that can be subtly, or not so subtly, different. Sorry, folks, but that ain't reuse.
Of course, you and I both know what's needed here: a good version control system. I guess that, in the warm glow of my delight with VC++ Express, I had put too much faith in its ability to manage software that is shared between projects.
Expect to hear more about this issue. I hope to find some guru, in Microsoft or not, who can tell me how best to handle the problem. In the meantime, just know that it is--or seems to be--a problem.