Jeremias Maerki wrote:
> On 09.09.2008 13:01:54 Vincent Hennebert wrote:
<snip/>
>>>      /** [EMAIL PROTECTED] */
>>>      protected void renderBlockViewport(BlockViewport bv, List children) {
>>> +        //Essentially the same code as in the super class but optimized 
>>> for the IF
>> More than 80% of the code of this method is completely identical to the
>> overridden method. Surely there’s a way to optimize it and avoid that
>> code duplication in the same time...
> 
> I've spent a lot of time in implementations of renderBlockViewport in
> the past. I've been able to make small improvements over time but I've
> never found a solution that fits all output formats so far. Without any
> major refactoring of the code anyway, which is basically what I'm doing
> in the branch right now.
> 
>> I can’t think of any good reason for copy-pasting code. That
>> artificially increases the size of the codebase, that makes the code
>> more difficult to understand and much more tricky to maintain. As soon
>> as a change is made somewhere, you’re almost sure that at least one
>> duplicated part will be forgotten somewhere.
> 
> Don't you think I know that copy/paste programming is bad?

That’s precisely why I don’t understand why there’s so much of that to
be found in the current code. Performance is not an argument if you ask
me. We’re not developing a software that will run on a micro-controller,
with a 68000 processor and where memory is counted in Kb instead of Gb.
The complexity of the topic makes it much more important to have
a codebase that is clean and conceptually simple. Anyway, there’s IMO
much more to achieve in terms of performance by working on the software
architecture rather than replacing a few method calls, early exiting
a loop, or whatever.


>> There is already way too much code duplication in the present codebase.
>> Let’s avoid introducing even more duplication in new commits, shall we?
> 
> I'm trying all the time. Please note: the branch is work in progress and
> once it's done many renderer implementations will get deprecated to
> lighten the maintainance burden. Eventually they'll get removed and the
> copy/paste problem goes away.

Then where is the TODO comment explaining exactly that? That would have
saved me the time to write this message, and saved you the time to
answer it. I can’t read in your mind...

Vincent

Reply via email to