Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Facade Pattern

 
Ixus See
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I implement Facade Pattern on my data.java

should my Lock manager and File Manager class be protected(accessible within the package only)?

Reason: There is no reason for other package from accessing my File and Lock manager and reduce requirement for javadoc comments :P
 
Sean Keane
Ranch Hand
Posts: 582
Chrome Eclipse IDE Java
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's good practice to only expose what is necessary. In a commercial environment this is even more important as you must support what you expose. Based on this line of thinking I would only expose classes outside of my package that need to be accessed outside of my package.

As for Java Doc comments. I would add Java Doc in exactly the same way to all my classes regardless of what the access level was on them. Reason being is that you should document all your code for other developers who come to read your code at a later point.
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree with Sean. In practice I'd probably put a lot less effort into documenting the non-public parts, but for this assignment I documented everything to the same level (and generated Javadocs to include public, protected and package access).
 
Ixus See
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i did document everything just that I don't want them to penalize me for my bad command of English.

=X
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic