Title: UML class diagrams (1)
1UML class diagrams (1)
- UML Unified Modeling Language
- We use only class diagrams, not other UML
diagrams - Purpose
- keep OO concepts separate from implementation
language - operate at a more abstract level than programming
language, to avoid making implementation
decisions when designing code
2UML class diagrams (2)
- Class box
- Class name
- Properties
- Behaviors
- Only as much detail as is needed
- Relationships
- inheritance
- implemention
- composition
- dependency
- association
3UML class diagrams (3)
4Where do objects come from?
- Objects are instances of classes
- We instantiate classes
- e.g. new chapter1.Terrarium()
- There are three parts to this expression
- new
- chapter1.Terrarium
- ()
5The parentheses delimit the argument list of the
constructor call. In this case there are no
arguments being passed along to the constructor,
so the argument list is empty.
new is a reserved word in Java. This means
that the word new has a special meaning in the
Java language.
new is the name of an operator whose job it is
to create an instance of a given class
chapter1.Terrarium is the name of the class we
are instantiating. It is a compound name,
consisting of a package name (chapter1) and the
name of the class constructor (Terrarium),
separated by a dot . A constructor
initializes the state of a newly created object.