[ 
https://issues.apache.org/jira/browse/PDFBOX-2576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14378722#comment-14378722
 ] 

John Hewson edited comment on PDFBOX-2576 at 3/24/15 9:58 PM:
--------------------------------------------------------------

However it's also harmful because the constant name obscures the constant 
value, which has been a source of bugs in PDFBox in cases where that value is 
wrong. For heavily used constants, it obviously makes sense, but for cases such 
as this one, where the only two usages are _on the same line_, the downside 
outweighs the benefit:

{code}
privDict.put("BlueValues", getDelta(privateDict, "BlueValues", null));
{code}

We can trivially see that there are no typos. I deliberately chose this 
approach because the old constants were confusing and buggy, so this is a step 
backwards! All it does is add 38 lines of code to "avoid typos" which weren't 
there in the first place.


was (Author: jahewson):
However it's also harmful because the constant name obscures the constant 
value, which has been a source of bugs in PDFBox in cases where that value is 
wrong. For heavily used constants, it obviously makes sense, but for cases such 
as this one, where the only two usages are _on the same line_, the downside 
outweighs the benefit:

{code}
privDict.put("BlueValues", getDelta(privateDict, "BlueValues", null));
{code}

We can trivially see that there are no typos. I deliberately chose this 
approach because the old constants were confusing and buggy, so this is a step 
backwards!

> Improve code quality
> --------------------
>
>                 Key: PDFBOX-2576
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2576
>             Project: PDFBox
>          Issue Type: Task
>    Affects Versions: 2.0.0
>            Reporter: Tilman Hausherr
>         Attachments: GraphicsOperatorProcessor.patch, 
> SecuryHandlerFactory.patch, org.apache.fontbox.afm.patch, 
> org.apache.fontbox.cff.cffparser.patch, org.apache.fontbox.cff.patch, 
> org.apache.fontbox.cmap.patch, 
> org.apache.pdfbox.contentstream.operator.state.patch, 
> org.apache.pdfbox.cos.patch, org.apache.pdfbox.filter-2.patch, 
> org.apache.pdfbox.filter.patch, org.apache.pdfbox.pdfwriter.COSWriter.patch, 
> org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.patch, 
> org.apache.pdfbox.pdmodel.documentinterchange.patch, 
> org.apache.pdfbox.preflight.graphic.patch, pdfbox-override-patch.txt, 
> pdfbox-raw-type-patch.txt, pdfcloneutility-patch.txt, 
> pdftextstripperbyarea-patch.txt, ttfsubsetter-2.patch, ttfsubsetter-3.patch, 
> ttfsubsetter-patch.txt
>
>
> This is a longterm issue for the task to improve code quality, by using the 
> [SonarQube 
> report|https://analysis.apache.org/dashboard/index/org.apache.pdfbox:pdfbox-reactor],
>  hints in different IDEs, the FindBugs tool and other code quality tools.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to