When we started Inkscape, we began with a codebase with lots of potential but with some architectural limitations that we've never quite resolved. Inkscape has grown rapidly, especially thanks to Google's Summer of Code program. Unfortunately, while we've gained a lot of new features, it hasn't addressed the underlying issues—and in some cases has exposed new problems.
Inkscape's also been extremely successful at gaining a lot of contributors, yet this comes with a price: Stylistic differences, accidental code duplication, unfinished code, obsoleted code, etc.
What does codebase cleanup work entail? The work ranges from straightforward “grunt” work like making some simple code changes to all files in the codebase, to meatier work like abstracting widely used code into a more concise and powerful algorithm, to advanced work such as extracting distinct code into independent code packages.
Objectives and Principles
To boil this down into five high level objectives:
- Complete some of the big architectural refactoring efforts
- Reduce source code line count
- Break useful code out into stand-alone libraries
- Increase code stylistic consistency
- Make the codebase more convenient to code in
Now, architectural reworkings can often risk incur massive breakages since fundamental pieces of the code are being changed. In order to minimize this, we would like to suggest the following principles:
- Always keep the tree buildable
- Always keep unit tests passing (and add new unit tests)
- Do major refactorings in small steps
- Hold code review parties with 2–3 others to brainstorm
- Drop copied-in codebases in favor of external dependencies
- Make sure every function you touch has some doxygen comments