[Libreoffice] Help concerning code style and documentation

Kohei Yoshida kyoshida at novell.com
Mon Nov 1 20:11:05 PDT 2010

Hi Regina,

On Sun, 2010-10-24 at 18:13 +0200, Regina Henschel wrote:
> Hi all,
> I'm currently working on LINEST and have attached a draft to issue
> http://www.openoffice.org/issues/show_bug.cgi?id=115189
> There is no mathematical problem, but I'm uncertain about coding style. 
> The algorithms work on matrices. They have a lot of parts which are 
> nearly identical but the matrices are transposed. How to handle that?

If one algorithm traverses matrix row-wise, and another column-wise,
then I would just leave them as-is.  There isn't much we could do to
reduce code side in that situation, and I don't think it would be worth
the effort.

If we really wanted, we could try templates as Thorsten suggested, but
we can try that after your initial code gets integrated with some test
cases to verify calculations.

> And I do not know how much comments are needed for those, who have to 
> maintain the code later, and if a separate documentation is needed.

As Michael said, your level of comments look just fine to me. :-)  The
only thing I would change is to remove commenting of closing braces.
For instance,

if (nCase == 2)
} // end of nCase == 2

type of comment is a bit too much since most modern editors should
detect the begin end brace pair.  I would consider this to be
over-commenting.  But other than that, your code looks just fine.

FYI, I'm planning to integrate a major refactoring of the guts of
ScMatrix, to push most of its implementation out to an external library
and to allow different base values (numerical-0 vs empty elements).  It
should not affect ScInterpreter code as the change should be transparent
to the users of ScMatrix, but I thought I would mention.

And I would probably be the one to maintain your code, unless you want
to maintain it yourself. ;-)

Thanks a lot, and keep us informed of your progress.


Kohei Yoshida, LibreOffice hacker, Calc
<kyoshida at novell.com>

More information about the LibreOffice mailing list