Class Diagram

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

How would I show that a class as a public attribute called address that is an Address type?

+ address: Address

How would I show that a class has a public method called complexCalculation that returns a double and takes two parameters; a double called alpha and an integer called gamma?

+ complexCalculation(alpha: double, gamma: integer): double

How would I show that a class as a private attribute called name that is a String type?

- name: String

How would I represent a multiplicity of 2 to many?

2..*

What is a meta model?

A model of a model

How do we represent a Composition type relationship between two classes in a Class Diagram?

A solid line connecting the two classes with a filled diamond at one end. The diamond goes next to the class that is composed of the other class. eg Person owns a Heart - the filled diamond goes next to the Person.

How do we represent an Aggregation type relationship between two classes in a Class Diagram?

A solid line connecting the two classes with an unfilled diamond at one end. The diamond goes next to the class that is aggregating the other class. eg Person has an Address - the diamond goes next to the Person.

How do we represent a Inheritance type relationship between two classes in a Class Diagram?

A solid line connecting the two classes with an unfilled triangle at one end. The triangle goes next to the super class. eg: Animal <|------- Dog (excuse the ASCII art, the line should be a solid line)

How do we represent an Association type relationship between two classes in a Class Diagram?

A solid line connecting the two classes.

What does a State Machine Diagram represent?

A state machine diagram describes the behaviour of an object, in particular focussing on the states the object could be in, the transitions between the states and the events that cause transitions.

Aggregation

A stronger relationship than Association. It represents a 'has a' type relationship. For example a Person has an Address. Implies that they can exist without each other.

UML Class Diagram

A structural UML diagram that represents the structure of an Object Orientated System by showing the Classes and Relationships between them.

Class

A template for creating objects of a certain type. A useful way of grouping related features or data into one place.

What are the major components of a Use Case Diagram?

Actors, Use Cases, Associations and the System Boundary

What are Use Case Diagrams used to model?

Business or system context. Requirements. In particular how various types of Actor (relevant people, jobs or roles) interact with Use Cases.

How would I represent that Class A realises the Interface B.

Class A -----------|> Interface B (The line SHOULD be dashed)

I have an association between the classes Dog and Cat and I want to show that the navigability between the two is undefined. How would i show this?

Dog ----------- Cat (excuse the ASCII art, the line should be a solid line)

I have an association between the classes Dog and Cat and I want to show that you can navigate from Dog to Cat but cannot navigate from Cat to Dog. How would I show this?

Dog -X----------> Cat (excuse the ASCII art ,the line should be a solid line)

What are the major components of a State Machine Diagram?

Events, Transitions and States

Name a Behavioural UML diagram

Many options: Activity diagram Communication diagram Interaction overview diagram Sequence diagram State diagram Timing diagram Use case diagram

Name a Structural UML diagram

Many options: Class diagram Component diagram Composite structure diagram Deployment diagram Object diagram Package diagram Profile diagram

Association

Relationship between two (or more) classes

Composition

Represents a relationship in which X 'owns a' Y. It implies that Y cannot exist on its own as it is a part of X.

What is an example of a meta model?

The class diagram for class diagrams.

How do I show that a class is an Abstract class or that a method is an Abstract method in a Class diagram

You make the class name or method name italic. You could also add <<abstract>> underneath the class name.

How would I convert the following attribute into Java code: - ownedCats : List<Cat>

private List<Cat> ownedCats;

How would I convert the following attribute into Java code: - favouriteNumber : int

private int favouriteNumber;

How would I convert the following Class into Java code: Animal <<abstract>> --------------- - name: String ----------------

public abstract class { private String name; }

How would I convert the following Class into Java code: Animal --------------- - name: String ---------------- + makeSound()

public class Animal{ private String name; public void makeSound(); }

How would I convert the following method into Java code: + complexCalculation(alpha: double, gamma: int): double

public double complexCalculation(double alpha, int gamma) { //Implementation goes here }

How would I convert the following into Java code: Flyable <<interface>> --------------- ---------------- + fly() <-- imagine this is italic

public interface Flyable { public abstract fly(); }


Ensembles d'études connexes

3.3 Given a scenario, implement secure network designs

View Set

Chapter 14: Accounting for Long-Term Liabilities

View Set

Chapter 4: Internal Analysis: Resources, Capabilities, and Core Competencies

View Set

Chapter 6 Infection Prevention and Control

View Set

ECON 2301 - exam 1-- Giant Aryani

View Set

Ch 66 PrepU: Management of Patients With Neurologic Dysfunction

View Set