Writer/ToDo/Writer Refactoring/Writer Refactoring

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

Jump to: navigation, search

Caution

This page is still under construction hence the content is still very tentative.

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

Steps

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 just include the header files for these interfaces instead of the whole doc.hxx
  in order to reduce unnecessary build time dependencies
  'Status: in progress 
  'Details: SwDoc (see sw/inc/doc.hxx) is a huge class with more than 130 data members and hundreds of member functions. This class 
    has mutliple responsibilities this implies that SwDoc has a lot of different clients. Each of these clients usually requires just a small part 
    of the SwDoc interface. With SRC680m146 434 of 763 source code files directly or indirectly include doc.hxx in which the interface of 
    SwDoc is declared. This results in undesirable build times when changing doc.hxx. 
    X Interfaces for SwDoc have been introduced related code has been changed to use these interfaces instead of the whole doc.hxx  

References

[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