
Operations are listed in the third section of the rectangle typically in the form of: The only time that attributes are made public is for constants (values cannot be changed), which are usually written as follows: public static int PI = 3.14 Īn action that can be performed by the class. Typically, attributes are private or protected if we want subclasses to inherit these attributes (more on this in Relationship section). Typically a class, interface, or built-in type such as int.ĭefault: The default value of the attribute. It can be: absent (meaning there is a multiplicity of 1) a single integer or a range of values specified between square brackets separated by “…”. Multiplicity: Specifies how many instances are referenced by this attribute. Typically the first letter is lowercase, and the first letter of each subsequent word is capitalized, this format is referred to as camel case. Name: The name is selected by you! Typically, it is a noun or short phrase to give the attribute a meaningful identity. For example, if the attribute is private, the attribute can only be accessed from inside the class. Access: This is where we can access the attribute from, also known as visibility.In a statically-typed language like Java, it is required to have an explicit data type for each attribute.Īttributes are listed in the second section typically in the form of: Example attributes for a Car class would be: colour, brand, model.Īttributes can have a data type to tell us how we would use the attribute e.g. The properties of a class are referred to as attributes. Is written in italics if the class is abstract.The class name is put in the top section and is typically formatted as following:



In a class diagram, we represent a class using a rectangle with 3 sections. ClassesĪ class represents a group of things that have common state and behaviour.įor example, Toyota and Ford are both types of cars, so you can represent them using a class named Car. For example, if it’s used as a communication aid for discussion between business people and technical people to understand the business, not too much detail is required. It is common to simplify and omit certain details of a class diagram, usually depending on the level of detail required to the needs of the project at that time. I use the UML terminology predominantly i.e. I present the typical format of class diagrams here. Class diagrams are used to show the structure and content of our application.Ĭlass diagrams are part of the Unified Modelling Language (UML) standard, categorized as a Structural Diagram.
