2.3 UML Class Models Flashcards

1
Q

What is UML used for?

A

To represent our software analysis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a UML Class Digram?

A

aka static structure diagram

contains representations of:
- classes
- interfaces
- objects
- relationships

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a Class?

A

A description of a similar set of instances.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What type of word makes a good class candidate?

A

Nouns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are candidates for a Class?

A
  • domain objects
  • roles
  • events
    -interactions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How is a class represented visually in UML?

A

Denoted by a rectangle with three horizontally partitioned units.

  1. Name (required)
  2. Attributes
  3. Operations
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does it mean when a class name is in italics?

A

It’s an abstract class.

Abstract classes describe the properties of subclasses but NEVER have their own instances.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why might you want to use an abstract class?

A

If you have related subclasses that have common features you can factor those features up into the abstract class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the symbols for visibility?

A

+ public
- private
# protected
~ package

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What attributes can you specify?

A
  • name
  • type
  • (optional) multiplicity and ordering
  • (optional) initial value
  • (optional) derivation
  • properties e.g., {frozen}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What operation parameters can you specify?

A
  • name
  • type
  • default value
  • kind (in, out, inout)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What operation properties can you specify?

A
  • {query}
  • {concurrency}
  • {abstract}
  • class scope (shown by an underline)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does an Interface require in UML?

A

Describe what the interface provides and requires.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

parameterized classes

A

Parameterized classes correspond to Java generics

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

nested classes

A
  • suitable for inner classes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

composite objects

A
  • class diagrams within class rectangles
16
Q
A

verbs describe relationships

association - people drive vehicles

generalization - a car is a kind of vehicle

dependencies - dependency between cars and pollution laws: if pollution laws change then cars might have to be adapted

17
Q

Aggregation vs Composition?

A

Say you have two classes: House and Room.

A House has a Room, but if you destroy the House, you also destroy the Room. Therefore, the association is NOT an aggregation but a Composition (open diamond).

In Composition there’s a responsibility for managing the lifetime of the constituent objects.

A particular constituent can only belong to one Composition.

Compositions also have the transitive property e.g., House can have Rooms and Rooms can have Closets. There is no such property for aggregations.

Aggregation = Open Diamond

Composition = Closed Diamond

18
Q

What is a qualifier?

A

A class attribute that provides access to instances of a particular class.

e.g., like the key in a database table.

19
Q

What is a link?

A

Just like classes can have instances, associations can have links.

20
Q

generalization

A

generalization is not inheritance. inheritance is an implementation whereas generalization is a modeling technique.

21
Q

What is overlapping vs disjoint?

A

Overlapping means a child class can inherit from more than one parent.

Disjoint means a child class can only inherit from one parent.

22
Q

What is complete vs incomplete?

A

Does the set of child classes cover all of the instances? if so, it’s complete, else incomplete.