Java Reference
In-Depth Information
Package
Package P
Package Q
Class A
Package P
Private
Protected
Child of A
Package P
Child of A
Package Q
Class B
Package P
Class C
Package Q
Public
Figure 9.2 Java visibilities allow us to restrict access to attributes and methods. From strictest
to loosest, we can restrict access to a class (private), a class and its descendents (protected),
a package (unspecified), or all classes (public).
9.4
Mini-antipatterns: Structure
Bad object-oriented code can come in any number of shapes and sizes. Novice
programmers make nearly universal mistakes as they try to mold the design
process to what they know. Language is a surprisingly effective tool to help
with the transition. Good object-oriented design is tough to dictate through
coding conventions, but enforcing some guidelines can improve code simplic-
ity, readability, and reuse. Some of the principles that can be enforced are ele-
mentary design, interface usage, and method complexity. In this section, we'll
discuss individual conventions for Java interfaces, packages, elementary code
structure, and basic design principles.
Search WWH ::




Custom Search