4. Object Model Flashcards

(34 cards)

1
Q

What is Object-Oriented Programming (OOP)?

A

OOP is a programming paradigm based on “objects,” which contain data (attributes or properties) and code (methods or functions). Objects are instances of classes, which determine their types.

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

What is Object-Oriented Design (OOD)?

A

OOD is the process of using objects and object-oriented programming principles when designing a software solution.

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

When one object calls a method of another, what are some key considerations for the calling object?

A

The calling object (client) must adhere to rules about calling the method (e.g., number of inputs, data types), and these rules are defined by the object being called (server). The server object might also keep its internal workings secret (information hiding).

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

What defines the acceptable calls an object can receive?

A

Acceptable calls are defined by the object’s methods (also known as operations, procedures, subroutines, or functions), each of which has a specific signature (name, parameters, types, etc.).

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

What is an object’s “interface”?

A

An object’s interface is the set of method signatures for that object. It defines the “services” the server object will offer.

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

What is “Information Hiding” in the context of OOD?

A

An object can hide its state (attributes) and restrict access to it, allowing interaction only through its public interface.

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

In object interaction, which object is the “client” and which is the “server”?

A

The object calling a method is the client object, and the object receiving and executing the call is the server object. The method call is the message.

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

What is modular programming?

A

Modular programming is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules (packages).

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

How do objects differ from modules in terms of data handling?

A

Modules are often loose groupings where “promiscuous” access to data can lead to misuse. Objects, in contrast, encapsulate data, meaning internal data is typically hidden and accessed via methods.

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

What is UML?

A

UML, or Unified Modeling Language, is a standardized visual language used in software engineering to represent different aspects of a system’s structure and behavior.

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

Name three types of diagrams in UML.

A

Examples include Class Diagrams, Use Case Diagrams, Sequence Diagrams, Activity Diagrams, State Machine Diagrams, Component Diagrams, Deployment Diagrams, and Package Diagrams.

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

What are the three compartments typically found in a UML class notation?

A
  1. Class Name,
  2. Attributes,
  3. Operations.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

In UML, what does a “+” symbol before an attribute or operation signify?

A

It signifies public visibility.

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

In UML class diagrams, what does a “-“ symbol typically signify when placed before an attribute or operation name?

A

In UML class diagrams, a “-“ symbol before an attribute or operation name typically signifies that the member has private visibility.

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

What is an “Association” in UML object relationships?

A

Association represents a relationship where one object accesses another in some way (e.g., calling a method, accessing an attribute). It can be bidirectional, unidirectional, or prohibited.

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

What is “Inheritance” (or Generalization) in UML?

A

Inheritance is when an object (subclass) inherits the properties (attributes and methods) of another object (superclass), representing an “is a” relationship.

17
Q

What is “Composition” in UML, and what kind of relationship does it represent?

A

Composition is a strong “has a” relationship where an object references another object as an instance variable, and the “part” object cannot exist independently of the “whole” object.

18
Q

How does “Aggregation” differ from “Composition” in UML?

A

Aggregation is a weaker “has a” relationship where the child class (part) can exist independently of the parent class (whole), unlike composition where the part cannot exist without the whole.

19
Q

In UML, what is the symbol for a “Realization” or “Implementation” relationship, and what does it generally signify?

A

The symbol for Realization/Implementation is a dashed line with a closed, unfilled arrowhead. It generally signifies that one classifier (e.g., a class) implements or realizes the contract specified by another classifier (e.g., an interface).

20
Q

In UML, what is the symbol for a “Dependency” relationship, and what does it generally signify?

A

The symbol for a Dependency relationship is a dashed line with an open arrowhead. It generally signifies that a change in one element (the supplier) may affect another element (the client) that depends on it.

21
Q

What is Polymorphism in OOP?

A

Polymorphism refers to the ability of objects of different classes to be treated as objects of a common superclass. It allows methods to be invoked on different objects in a uniform manner, providing a single interface to entities of different types. It’s the ability to take on many forms.

22
Q

What are the two main types of polymorphism?

A
  1. Compile-time Polymorphism (Static Binding or Early Binding), e.g., method and operator overloading.
  2. Runtime Polymorphism (Dynamic Binding or Late Binding), e.g., method overriding and interface implementation.
23
Q

What is “Duck Typing”?

A

Duck Typing is a concept where an object’s type/class is less important than the methods it defines. If an object supports the required methods or properties for an operation, it’s considered to be of the expected type, even without explicit inheritance

24
Q

Explain “Subtyping” as a form of polymorphism.

A

Subtyping is a type of polymorphism where code written for a supertype will also work correctly on objects of its subtypes. This is often achieved through inheritance.

25
What is "Ad-hoc polymorphism" also known as?
Method overloading or operator overloading. It refers to a single name or symbol having multiple implementations depending on the arguments.
26
What is the difference between static dispatch and dynamic dispatch?
If the implementation under a polymorphism is selected at compile time, it's static dispatch (static polymorphism). If selected at run time, it's dynamic dispatch (dynamic polymorphism).
27
List one pro and one con of using polymorphism.
Pro: Allows code reuse, helps cut down on code size, can improve code modularity. Con: Can be complex, can make code harder to read (uncertainty about which implementation is called), dynamic dispatch can be slower.
28
Why is Object-Oriented Design generally beneficial for software development?
Modularity and reusability make development easier, faster, more productive, and cheaper, and also make systems easier to maintain.
29
How does Object-Oriented design typically compare to Process-Oriented design in terms of intuition and scalability?
Process-Oriented design is often more intuitive as it's person-centric (x happens then y). Object-Oriented design involves labor-division, making it potentially more confusing initially but is organization-centric and designed to scale to large problems.
30
Name three key methodological factors for designing good OO systems.
Agility (like Scrum), Traceability, Testability, Measurability, and Security.
31
What is "Traceability" in software systems development?
The ability to trace the evolution of a software system step-by-step, from individual requirements to blocks of code. One should always be able to answer "why is this here?".
32
How does Test-Driven Development (TDD) relate to "Testability" in OO systems?
In TDD, software requirements are converted to test cases before software is fully developed. Developers shouldn't create an artifact unless they know how it will be tested.
33
What aspects can "Measurability" cover in software development?
Measuring the quality of the software (e.g., usage statistics, bug reports, performance) and the productivity of development (e.g., Scrum points, burndown charts).
34
Why is "Security" an important consideration in OO design?
Security issues can arise from poorly designed code or interconnectivity. Security needs may also conflict with other requirements like ease of use.