Tuesday, March 01, 2011

Class diagram notations and their Java interpretations

Inheritance:


interface list extends Collection;

class ArrayList extends AbstractList;

Realization:


class ArrayList implements List;

Dependency:

When a class has a reference to another class or interface (in instance variables, arguments, local values, return values or anywhere else) then there is a dependency



class DriverManager {
...
Connection getConnection(String url);
...
}


Association:

An association is a special type of dependency. All associations are dependencies. An association is used when the dependency is always there (as opposed to dependency existing only during the course of a method execution). Its more often (not always) used to represent a field in a class. For more information see here.


class Order {
private Customer customer;
}

No comments: