Writer/ToDo/Writer Refactoring/Writer Refactoring

From Apache OpenOffice Wiki
< Writer‎ | ToDo
Revision as of 10:49, 30 December 2005 by Tra (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Problem statement

As Bertrand Meyer [1] describes external software qualities (experienced by the user of the software) like

  • Correctness - The ability of software products to perform their exact tasks, as defined by their specification.
  • Robustness - The ability of software systems to react appropriately to abnormal conditions.
  • Efficiency - The ability of a software system to place as few as possible demands on hardware resources, such as processor time, space occupied etc.

for instances are in direct relation to internal software qualities (experienced only by computer professionals with access to the source code of the software) like modularity, testability, maintainability.

The current Writer code base has some serious quality problems with regards to these internal software qualities what consequently leads to external quality problems like crash reports, malfunctions, performance problems, memory leaks. See [2] for some concrete examples otherwise use IssueZilla and search for defects in OOo Writer.

Some facts and numbers about the writer code and and the code quality (still) in random order

  • Build time - to build the Writer from scratch takes
  • Link time dependencies - linking the Writer roughly takes x minutes on a
  • Code not testable because of cyclic dependencies
  • No unit tests available - Until milestone SRC680m147 there exist not a single unti test for the Writer code
  • Code optimized for legacy computer systems e.g. Win16 - Example: BigPtrArray (see sw/source/core/bastyp/bparr.cxx)
  • Redundant code
  • Big and complex classes with multiple responsibilities - Example: SwDoc
  • No clearly designed and documented interfaces and abstractions
  • Hand crafted data structures (no STL)
  • Unwanted dependencies between UI, Core, Layout
  • Fragile code (Undo, Redlining, ...)
  • Base classes without virtual destructor
  • Single argument constructors are not declared 'explicit'
  • Wrong initialization sequence of class members
  • Lack of documentation

Goal statement

  • Prioritize problems
  • Break problems into pieces <= 3 man months


On cws writercorerefactoring the following steps are planned:

  • Removal of unused files
 Status: done Details: 19 files which were not build anymore have been removed
  • Removal of unnecessary includes of headers
 Status:' done Details: 850 unnecessary includes of header files have been removed in the Writer code base
  • Removal of unused code (how many lines?)
 Status: in progress Details: 
  • Write unit test
  Status: in progress Details: 1 unit test for BigPtrArray has been introduced
  • Make SwDoc interface based, changes clients of SwDoc to use these interfaces
  Status: in progress Details: X Interfaces for SwDoc have been introduced related code has been changed to use these interfaces instead of the whole doc.hxx  

Rough ideas


[1] Betrand Meyer, Object Oriented Software Construction, ISBN: 0-13-629155-4

[2] Long existing, hard to fix quality problems in OOo Writer (to be extended)

  • Cannot select whole document when table is at beginning
  • Backspace may take several seconds in documents with many hidden redlines
  • Undo-delete still doesn't work in all circumstances (section-to-section)
Personal tools