University of Arizona
Dashboard > Kuali Implementation Technical Team > Home > UML Quickstart Guide
Site Search:

View Attachments (5) Info

UML Quickstart Guide

Some basics on UML. Goes over Class inheritance, aggregation, interfaces and has two simple examples of a class and sequence diagram.

Inheritance


Simple example of one class extending another. No attributes or operations recorded. Make note of the solid line with hollow arrow. This is indicative of inheritance. Below is a java code equivalent of the above illustration.

class Superclass {
}
class Subclass extends Superclass {
}

Aggregation

This is an example of how one class can be composed of another and aggregated to other classes. Take AClass for example. AClass aggregates names which is a List of String instances. Notice that the hollow diamond indicates aggregation. This is how we know that AClass aggregates names. The solid diamond indicates composition. This means that List is composed of String instances and only String instances. That is that the two are non-separable in their distinction. Below is a java code equivalent of the above illustration.

public class AClass {
    public List<String> names; 
}

Interfaces

The above illustrates what interfaces look like in UML. Notice there's a SuperInterface that is extended by another interface and then implemented by InterfaceImpl. Below is the java code equivalent of the above illustration

public interface SuperInterface {
}
interface Interface extends SuperInterface {
    public void execute();
}

class InterfaceImpl implements Interface {
    public void execute() {
    }
}

Class

The above illustration is like your all-in-one example of pretty much everything you can do in a class diagram. There are 2 interfaces Interface1 and Interface2.

  • Interface1 has only one method that is abstract that returns a String.
  • Interface2 has one method that is abstract, but doesn't return anything.

There are 2 classes.

  • Class1 implements Interface1.
  • It has
    • a public method called "publicMethod" that is concrete that takes no arguments and returns a String.
    • a public abstract method called "publicAbstractMethod" that returns a String and takes no arguments
    • a public virtual method called "publicVirtualMethod" that returns a String and takes no arguments
    • a public static method called "publicClassMethod" that returns a Integer and takes no arguments
    • a protected method called "protectedMethod" that returns a Float and takes no arguments
    • a private method called "privateMethod" that returns a Double and takes no arguments
    • a public method called "publicMethodWithParams" that returns nothing and takes one Integer and one String argument
  • Class2 extends Class1 implements Interface2
  • It has
    • A private String member called "privateMember"
    • A protected Integer member called "protectedMember"
    • A public Double member called "publicMember"
    • A public constant member called "CONSTANT_MEMBER"

You may notice the different symbols. (-,#,+) are access control symbols. Also, there are some style symbols (italics, bold, plain) that should be noticed. Below is the java code equivalent to the above.

interface Interface1 {
    public String someMethod();
}

interface Interface2() {
    public void execute();
}

class abstract Class1 implements Interface1 {
    public String someMethod() {
        return null;
    }

    public String publicMethod() {
        return null;
    }

    public abstract String publicAbstractMethod();

    public abstract String public VirtualMethod();

    public static Integer publicClassMethod() {
        return null;
    }

    protected Float protectedMethod() {
        return null;
    }

    private Double privateMethod() {
        return null;
    }
    
    public void publicMethodWithParams(String name, Integer value) {
    }
}

class Class2 extends Class1 implements Interface2 {
    public void execute() {}

    public String publicAbstractMethod() {
        return null;
    }

    public String publicVirtualMethod() {
        return null;
    }

    private String privateMember;
    protected Float protectedMember;
    public Double publicMember;
    public static Integer CONSTANT_MEMBER = 10;
}

Sequence


View a printable version of the current page.

Browse Space
- Pages
- Labels
- Attachments
- Mail
- Bookmarks
- News
- Activity
- Advanced

Explore Confluence
- Popular Labels
- Notation Guide

Your Account
Log In

 

Add Content


Powered by Atlassian Confluence 1115, the Enterprise Wiki.. Contact administrators.