Java Reference
In-Depth Information
Figure 8.1
Fields in
MessagePost and
PhotoPost objects
Figure 8.2
Details of the
MessagePost and
PhotoPost classes
Some of these data items should probably also have accessor and mutator methods (Figure 8.2). 1 For
our purpose, it is not important to decide on the exact details of all the methods right now, but just to
get a first impression of the design of this application. In this figure, we have defined accessor and
mutator methods for those fields that may change over time (“liking” or “unliking” a post and adding
a comment) and assume for now that the other fields are set in the constructor. We have also added a
method called display that will show details of a MessagePost or PhotoPost object.
1
The notation style for class diagrams that is used in this topic and in BlueJ is a subset of a widely used
notation called UML. Although we do not use everything from UML (by far), we attempt to use UML
notation for those things that we show. The UML style defines how fields and methods are shown in a
class diagram. The class is divided into three parts that show (in this order from the top) the class name,
the fields, and the methods.
 
Search WWH ::




Custom Search