官术网_书友最值得收藏!

Class diagrams

The class diagram is the most commonly used UML diagram, as it provides a visual description of a system's objects. Consider that, in Java, everything is an object, so you can see the relevance and reason as to why this particular diagram is so widely used. Class diagrams do more than just display objects—they visually depict their construction and relationships with other classes. 

As you can see here, the basic component of the class diagram is a rectangle, divided into three sections. Each overall rectangle represents a class, and the class name appears using a bold typeface in the top section. The middle section contains attributes that correlate to variable fields. The third section contains operation data which, in Java, means functions and methods:

The class diagram structure

A simple example of a class diagram for a Kennel is displayed in the following diagram. The class name is Kennel, and there are three attributes (animal, breed, and name) and two operations (intake and discharge):

A class diagram of our Kennel class

We will further explore class diagrams using our Kennel class example later in this chapter.

主站蜘蛛池模板: 瑞安市| 英超| 德阳市| 洪洞县| 四平市| 肥城市| 新沂市| 精河县| 勐海县| 镇江市| 天祝| 桃源县| 增城市| 林口县| 乌什县| 仪征市| 富顺县| 岳阳市| 桃园县| 荆门市| 广河县| 苍南县| 武陟县| 清涧县| 包头市| 鄂伦春自治旗| 康保县| 怀来县| 托克逊县| 龙口市| 合山市| 临夏市| 平安县| 鄂尔多斯市| 邹城市| 隆昌县| 香河县| 聊城市| 许昌市| 乐平市| 静乐县|