FINAL EXAM Flashcards
What is the single responsibility principle?
A class or module should have only one reason to change, focusing on a single responsibility or functionality.
What is the open closed principle?
Software entities should be open for extension but closed for modification, allowing new functionality without altering existing code.
What is the Liskov Substitution Principle?
Subtypes should be substitutable for their base types, ensuring that derived classes maintain the behavior of their parent class.
What is the Interface Segregation Principle?
Interfaces should be small and focused, preventing the dependency on methods that aren’t relevant to a class’s functionality.
What is the Dependency Inversion Principle?
High-level modules should not depend on low-level modules, instead, both should depend on abstractions, promoting flexibility and decoupling.
What is a requirement?
Something the system must do in order to
function correctly.
What is a use case?
The steps the system takes to complete a
requirement
Use Case Relationships should include?
Associations, includes «include», extends «extent» and generalization.
What is the Model-View-Controller (MVC) pattern?
Model-View-Controller (MVC) pattern is a software design pattern that separates the application logic into three interconnected components:
Model: Represents the application’s data and business logic, responsible for retrieving and storing data, as well as processing and managing it.
View: Represents the user interface and presentation of the data, responsible for displaying the data from the Model to the user.
Controller: Acts as an intermediary between the Model and View, responsible for receiving user inputs from the View, processing them, and updating the Model and View accordingly.
What is the Factory Pattern?
The Factory pattern is a creational design pattern used in software development that provides an interface for creating objects in a superclass, allowing subclasses to determine which class to instantiate. Instead of calling a constructor directly to create an object, the Factory pattern uses a separate method or class (the “factory”) to create and return instances of different classes based on input parameters or conditions.
What is a singleton pattern?
The Singleton pattern is a creational design pattern that ensures a class has only one instance throughout the application’s lifecycle and provides a global access point to that instance. This pattern is useful when a single, shared object is needed to coordinate actions across multiple components or when it’s important to control the number of instances of a class due to resource constraints or to maintain consistency.
The principle that states “Software entities should be open for extension but closed for modification” is known as:
a) Single Responsibility Principle
b) Open Closed Principle
c) Liskov Substitution Principle
d) Dependency Inversion Principle
b
A relationship where we can say class B “is-a” class A is best modelled as:
a) Inheritance
b) Aggregation
c) Composition
d) Delegation
a
When you only want one instance of a class to exist ever in your program, you should:
a) Use a static variable to represent the single instance
b) Use a singleton pattern
c) Use a factory pattern
d) Use the MVC Pattern
b
Which design pattern separates an application into three interconnected components: Model, View, and Controller?
a) Singleton Pattern
b) Factory Pattern
c) MVC Pattern
d) Adapter Pattern
c