Tuesday, September 13, 2011

Reusing of Classes in a New Project

I recently started a new small software project (program). Part of its functionality and GUI is common with another my relatively mature program. The latter consists of many classes written during 2 years. Although I tried to apply the best principles of Object-Oriented design and programming, such as incapsulation, the least possible coupling between classes and units, programming via interfaces and not implementations, etc., but when code of your classes is used in only one project, it is very easy to leave some project (or domain-) specific code in places where it should not be found. This leads to more tightly coupled code and reduce overall system maintainability. When you attempt to use such classes in another application, all such poorly written places become obvious. I have already fixed several errors of that kind, and I see now that my first project also will gain benefits from it, via improved code readability and structuring, despite the fact that I did not add features to it. I think it would be a good practice to always have at least two projects which both use a set of common classes, in order to be sure that those classes are written properly and do not make unnecessary assumptions about their usage.

No comments:

Post a Comment