It is really a long since my last algorithm post. I am really not mean to do it, because I have few hassle problems need to be handled carefully. However, I think I could post a series of post in the coming few days, which will focus on a problem I met and took a lot of my coding efforts. I will call it "CUT AND PASTE" problem.
This problem can be described in the following manner:
When you decomposed your big requirement into a number of small components, which could be executables, those small components are implemented separately. But they may share some common functional units, such as file loader, or format convertor. Those functional units may work very similar to each other, but there may still have some tiny differences. You may directly "CUT AND PASTE" your code from other directories and use them in your new applications. In the near future, you will find your previous implementation is not so good, or add some new functions, this "CUT AND PASTE" may cause many problems, which may take you a lot of time to keep them synchronized.
You may say that why not use a library? Sure, you could do that, but once you make a library, any changes will affect all code which depends on it. It is not a selective process.
I have an idea popped in my mind. Can we create a branch based local version control system that lets you choose which file to be updated and how to update. Once you make an update, the system could record your changes and give a name to this change. The shared files are located in a centralized folder, which is monitored by the system. When you compile your code, the further updated which submitted later than the last edited time of the project will be set transparent. Then, if you want to change to another version, or say synchronize some updates, you could select all the versions in the branches, including the newest changes. Once you made the decision, the other versions of the file will be transparent.