Refactoring plan

From Inkscape Wiki
Jump to: navigation, search


Overview

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

Objectives

To boil this down into five high level objectives:

  1. Complete some of the big architectural refactoring efforts
  2. Reduce source code line count
  3. Break useful code out into stand-alone libraries
  4. Increase code stylistic consistency
  5. Make the codebase more convenient to code in

Principles

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:

  1. Always keep the tree buildable
  2. Always keep unit tests passing (and add new unit tests)
  3. Do major refactorings in small steps
  4. Hold code review parties with 2–3 others to brainstorm
  5. Drop copied-in codebases in favor of external dependencies
  6. Make sure every function you touch has some doxygen comments