6.Structural Modelling using Class, Package Diagrams Flashcards

1
Q

What is the purpose of a Class diagram in UML?

A

A class diagram represents a set of classes, interfaces, their collaborations, and relationships in a system or software application.

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

What is a Class in object-oriented programming, and how does it relate to the creation of objects, their shared attributes, and the concept of instantiation?

A
  • A class is a blue print (template) for creating objects.
  • All the objects created using the same class share simillar attributes and methods.
  • Instantiation is a concept that refers to* the process of creating an instance or an object of a class.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How should the class name be represented in UML?

A

Class names should be a single word, written without spaces and class name** should start with an uppercase letter**.

If the class name consists of multiple words, we combine the words together and make the** first letter of each word capitalized.**
Single Word: Car
Multiple Words: StudentRecord, BankAccount.

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

What are attributes in a class, and what are the recommended conventions for writing attribute names?

A

Attributes are characteristics or properties of interest about an object.
If an attribute name consists of multiple words, you combine the words by removing spaces, and the first letter of each added word after the first one is uppercase.
Note: There can be classes with no attributes.

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

Elaborate on the concept of methods/operations/services within a class?

A

Methods are services that objects of a class can perform.
Method Names Start with a Lowercase Letter.
If a method name consists of multiple words, you combine the words by removing spaces, and the first letter of each added word after the first one is uppercase.
They are sufixed with parenthesis.
e.g. addClothes()

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

What is the primary purpose of utilizing access modifiers in programming?

A

The primary purpose of utilizing access modifiers is to* control the accessibility of attributes and methods from other parts of the program.
Access modifiers help to enforce encapsulation.

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

Name access modifiers and describe the symbols used to represent each modifier?

A
  1. + Public :are accessible from any part of the program.
  2. - Private :are only accessible within the class where they are defined.
  3. #Protected : are accessible within the class and its subclasses (derived classes or child classes).
    They are not accessible from unrelated classes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

In order to get things done a class must interact with another class or with the same class.
What are the different types of relationships between classes?

A

1.Association
2.Aggregation
3.Composition

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

What is an Association Relationship and how is it represented in a UML diagram?

A

An association relationship indicates a natural business association between classes where a class can send massages to other classes that are connected to it.

  • Associations are represented using a solid line connecting classes in the relationship.
  • Associations can be unidirectional(one way) or bidirectional(Two way with no arrow heads.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is an association name?

A
  • Usually the name of the association is an active verb or verb phrase that communicates the meaning of the relationship.
    Association name is optional.
    eg. a Lecturer teaches a Course.

Note: Aggregation relationships typically are not named. They are read using the words “has”, “part of” or “contains”.

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

What is a Role name in an association?

A
  • The end of an association where it connects to a class is called an association role.
  • Role name can be used instead of association names.
  • It is a noun that describes the reason the relationship exists.
  • The role name is placed on the association near the class it modifies.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the Multiplicity Indicators?

A

1 - Exactly one
0..* - Zero or more
1..* - One or more
0..1 - Zero or one
5..8 - Specific Range (5,6,7 or 8)

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

What are Reflexive Relationships/Associations?

A

When a class is in association with itself we call it a reflexive association.
(This is denoted by drawing a solid line connecting a class with itself. )

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

Explain Aggregation and how is it represented in a Class diagram?

A

An aggregation is a stronger form of association where one class (whole class) is created using part classes.
Note: In aggregation if whole is to die, parts will not die with it.

Aggregation is represented using a hollowed diamond, drawn closer to the whole class.

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

What is Composition and how is it represented in a Class diagram?

A

An Composition is a stronger form of aggregation where the whole class is composed with part classes.
Note: In composition if whole is to die, parts will die with it.
Aggregation is represented using a filled diamond, drawn closer to the whole class.

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

What are Dependency Relationships?

A

This is a weaker form of association between packages (a collection of classes represented using a folder symbol ).
This is drawn as a dotted line.

17
Q

What is an Inheritance relationship and how is it represented in a class diagram?

A

Inheritence is the parent child relationship between classes where one class known as the parent class or base class, can inherit its attributes and methods to another class, referred to as the child class or derived class.

18
Q

Name 5 characteristics of an inheritance relationship?

A
  1. It is not a relationship between different objects.
  2. It is a relationship between different classes.
  3. It is never named.
  4. Role names are not used.
  5. Multiplicity does not apply.
19
Q

The purpose of Generalization?

A

Generalization provides the capability to create super-classes that encapsulate structure and behaviour common to several classes.

20
Q

The purpose of Specialization?

A

Specialization provides the ability to create subclasses that represent refinement to the super class. Typically structure and behaviour are added to the new subclass.

21
Q

Define Single Inheritance and Multiple Inheritance.

A
  1. Single Inheritance
    * When a class has only one parent class it is known as single inheritence.
  2. Multiple Inheritance.
    * When a class has more than one parent classes it is known as multiple inheritence.
22
Q

How to represent abstract classes in class diagrams?

A

Class Name: Write the name of the abstract class in italic font to indicate that it’s abstract.
e.g. Animal

23
Q

Name the four most common approaches for object identification

A
  1. Textual Analysis.
  2. Brainstorming.
  3. Common Object List, and
  4. Patterns.
24
Q

Explain the process of textual analysis in Object Identification?

A
  • The analyst performs textual analysis by reviewing
    the use-case diagrams and examining the text in the use-case descriptions/narratives to identify potential objects, attributes, operations, and relationships.
  • The nouns in the use case suggest possible classes, and the verbs suggest possible operations.
25
Q

Explain the process of Brainstorming in Object Identification?

A
  1. During the analysis phase, participants will discuss among themselves to identify attributes and methods.
  2. CRC cards can be used for this purpose.
  3. This can be used to identify relationship amoung classes too.
26
Q

What is the purpose of using CRC (Class–Responsibility–Collaboration) cards in a brainstorming session for object identification?

A
  • CRC (Class–Responsibility–Collaboration) cards are used to document the responsibilities and collaborations of a class.
  • CRC cards are a set of index cards that allow you to identify all the information specific to a class using a simple technique.
27
Q

Name the key Elements of a CRC Card.

A
  1. Class Name
  2. Responsibilities (Methods)
  3. Collaborators (Other classes that are connected to the class).
  4. Attributes.
  5. Relationships (Different types of relationships that a class has such as aggregation, composition, Association,etc).
28
Q

Name the seven typical steps in , Role-Playing CRC Cards with Use Cases.

A
  1. Create CRC Cards.
  2. Review CRC Cards.
  3. Role-Play the CRC Cards.
  4. Create Class Diagram
  5. Review Class Diagram. (Detect Issues).
  6. Incorporate Patterns.
  7. Review the Model.
29
Q

What is an Object List in Object Identification?

A
  • A common object list is simply a list of objects
    common to the business domain of the system.
  • There are libraries of reusable objects that have
    been created for different business domains and they can be used as the initial list objects.
30
Q

What are Patterns in Object Identification?

A
  • A pattern is simply a useful group of collaborating classes that provide a solution to a commonly occurring problem.
  • Patterns provide a solution to commonly occurring
    problems, and hence they are reusable.
31
Q

What is a stereotype and what are the three key class stereotypes in UML.

A
  • A stereotype is a mechanism used to categorize classes.
  • In UML, there are three primary class stereotypes. They are:
    1. Boundary |-O
    2. Entity O
    3. Control O
32
Q

What is the purpose of Boundary Classes in a software system, and how do they provide an interface for users or other systems to interact with the system?

A

**1. Facilitating Interaction: **They provide the interface to a user or another system. (e.g. Interface to an actor). Handles communication between system
surroundings and the inside of the system.
2. Actor-Use Case Interaction: At a minimum there must be, one Boundary class for every actor-use case interaction.
**3. Reusability: **You do not necessarily have to create a unique Boundary class for every actor-use case pair as multiple actor may initiate the same use case. Hence, it allows them to use the same boundary class.

33
Q

Name and define the different types of Boundary Classes that mediate between the system boundary and its environment.

A
  1. User Interface class – classes that interface between the system and humans.
  2. System Interface class – classes that interface with other systems.
  3. Device Interface class – classes that interface with external devices such as sensors.
34
Q

Define an Entity Class and explain how to identify entity classes in a system.

A
  • They are needed to perform task internal to the system. Reflect a real-world entity.
  • To identify entity classes from The initial list of nouns must be filtered because it could contain nouns that are , outside the problem domain, just language expressions, redundant , attributes.
35
Q
  1. What is the role of a Control Class in UML and how does it relate to Boundary and Entity Classes in terms of communication?
    2.How many Control Classes are typically associated with a single use case, and what is their function in coordinating events?
A
  1. Control classes process messages from a boundary class (interface class) and respond to them by sending and receiving messages from the entity classes.
  2. There is typically one control class per use case and it co-ordinates the events needed to realise the behaviour specified in the use case.
    E.g. Running or executing the use case