Difference between revisions of "Writer/ToDo/Writer Refactoring/Writer Refactoring"

From Apache OpenOffice Wiki
< Writer‎ | ToDo
Jump to: navigation, search
(Steps)
Line 42: Line 42:
 
   '''Status:''' done '''Details:''' 19 files which were not build anymore have been removed
 
   '''Status:''' done '''Details:''' 19 files which were not build anymore have been removed
 
* Removal of unnecessary includes of headers
 
* Removal of unnecessary includes of headers
   '''Status:''' done '''Details:'' 850 unnecessary includes of header files have been removed in the Writer code base
+
   '''Status:'' done '''Details:'' 850 unnecessary includes of header files have been removed in the Writer code base
* Removal of unused code (how many lines?)
+
* Removal of unused/inactive code (how many lines?)
   '''Status:'' in progress '''Details:''  
+
   '''Status:''' in progress '''Details:''' There is a lot of code commented out via #if 0 ... #endif, /* */, or no longer used defines e.g. 'JAVASCRIPT'.
 +
  '''Reason:''' Inactive code is a unnecessary burden and often confuses potential maintainer of the code.
 
* Write unit test  
 
* Write unit test  
   '''Status:'' in progress '''Details:'' 1 unit test for BigPtrArray has been introduced
+
   '''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
 
* Make SwDoc interface based, changes clients of SwDoc to just include the header files for these interfaces instead of the whole doc.hxx
   '''Goal:'' Reduce unnecessary build time dependencies, first step to break SwDoc into managable and testable pieces
+
   '''Goal:''' Reduce unnecessary build time dependencies, first step to break SwDoc into managable and testable pieces
   '''Status:'' in progress  
+
   '''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  
+
   '''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  
 
     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  
 
     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.  
 
     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
+
     X Interfaces for SwDoc have been introduced related code has been changed to use these interfaces instead of the whole doc.hxx
  
 
== References ==
 
== References ==

Revision as of 06:48, 20 January 2006

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/inactive code (how many lines?)
 Status: in progress Details: There is a lot of code commented out via #if 0 ... #endif, /* */, or no longer used defines e.g. 'JAVASCRIPT'.
 Reason: Inactive code is a unnecessary burden and often confuses potential maintainer of the code. 
  • 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
  Goal: Reduce unnecessary build time dependencies, first step to break SwDoc into managable and testable pieces
  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