(Still catching up with the commits of the past month...)

I’d like to take this commit as an opportunity to launch the debate
about copy-pasting:

> Date: Mon Jul 28 06:03:40 2008
> New Revision: 680339
> Modified: 
> xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java
> URL: 
> http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java?rev=680339&r1=680338&r2=680339&view=diff
> ==============================================================================
> --- 
> xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java
>  (original)
> +++ 
> xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java
>  Mon Jul 28 06:03:40 2008
> @@ -361,9 +395,120 @@
>      /** [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 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.

There is already way too much code duplication in the present codebase.
Let’s avoid introducing even more duplication in new commits, shall we?


Reply via email to