[
https://issues.apache.org/jira/browse/PDFBOX-2672?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14311550#comment-14311550
]
Andrea Vacondio commented on PDFBOX-2672:
-----------------------------------------
I think direct field access is fairly accepted as a bad practice and makes the
API weaker by exposing implementation details and making difficult, if not
impossible, to future change related object internals without breaking the
contract. It more or less all boils down to the fact that accessors make the
objects more "future changes proof".
I'd be also very surprised if direct access would have better performance. I
haven't tested myself but here there is a discussion about it and they say the
compiler is smart enough to make direct access and trivial getter access
identical, which sounds reasonable:
http://stackoverflow.com/questions/23931546/java-getter-and-setter-faster-than-direct-access
Those rules I pointed out are all indeed quite obvious, but obvious is
subjective and I found them overlooked many times in many projects. Anyway, I
just thought they might be worth mentioning but I'm perfectly fine with the set
of rules you'll come up and I'll stick with them in case I'm going to commit
something ;)
> Wrong code convention link on the website
> -----------------------------------------
>
> Key: PDFBOX-2672
> URL: https://issues.apache.org/jira/browse/PDFBOX-2672
> Project: PDFBox
> Issue Type: Bug
> Components: Documentation
> Reporter: Andrea Vacondio
> Priority: Trivial
>
> Currently the website page https://pdfbox.apache.org/codingconventions.html
> points to the Sun's code convention -> http://java.sun.com/docs/codeconv but
> that page doesn't exist anymore.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]