software design vocab

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/33

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

34 Terms

1
New cards

abstraction

hiding implementation details while exposing only essential features

2
New cards

Encapsulation

protects object integrity by controlling access to data

3
New cards

Tight coupling

class depends on specific methods or fields of another class

4
New cards

Low coupling

minimizes dependencies between classes, making changes in one class less liley to impact others

5
New cards

abstraction and encapulsation how they related and different

They are related in a way that encapsulation helps achieve abstraction.

They are different in the sense that abstraction focuses on hiding complexity of the system and encapsulation focusses on specifically restricting access to data or methods in a clas

6
New cards

Private keyword

demonstrates encapsulation. Encapsulation restricts direct access to the internal state of an object and only allows controlled access through public methods (deposit, withdraw, getBalance).

7
New cards

high cohesion

High cohesion because the class only deals with balance (focused on one responsibility).

8
New cards

This

keyword used to indicate the current object's members

9
New cards

protected

accessible to subclasses or classes in the same

Package

10
New cards

super

a reference variable that points to the parent class object. It is used in a subclass to access member

11
New cards

Liskov Substitution Principle

Violated when a subclass modifies behavior in a way that contradicts the expectations sets by its parent class

12
New cards

Composition over inheritance improve software design

it allows code to be more flexible by favoring delegation over hierarchy

13
New cards

SRP violation

Class has more than one reason to change such as

generating invoices, printing, and sending them

14
New cards

Model in MVC controller

stores the application's data

15
New cards

Inheritance vs compositiobn

composition main class has subclass. so car has engine

class Car { public Engine engine;

Car(Engine engine){ this.engine = engine; }

void drive(){ System.out.println("Car is driving..."); }}

16
New cards

DIP

high level modules should not depend on low level modules.

for example,

The Computer class directly depends on the concrete Keyboard class.

class Computer {

private Keyboard keyboard;

Computer(Keyboard keyboard){this.keyboard = keyboard;}

void use() { keyboard.type(); }

}

17
New cards

Interface Segregation Principle

a class should not be forced to implement interfaces it doesn't need to

18
New cards

Open/Closed Principle

a class should be open for extension butclosed for modification

19
New cards

Dependency Inversion Principle

objects should depend on abstractions instead of concrete implementations

20
New cards

Abstract data types

Definition: A collection of well-defined behaviors, irrespective of implementation details• Examples: Lists, maps, sets, stacks, queues

21
New cards

Model-View-Controller

a pattern which supports separation

of concerns for applications with user interfaces.

22
New cards

View

Allows users to input data and displays new data from the

model

23
New cards

Controller

Connects the view and model by receiving user

inputs, processing data, updating the data in the model, then

triggering a refresh of the view.

24
New cards

Singleton

creational pattern controls object instantiation at the cost of introducing global state

25
New cards

Builder

creational pattern is best suited for constructing an object where multiple configuration steps are required

26
New cards

primary benefit of using creational design patterns

They abstract the process of object creation, making code more flexible and reusable.

27
New cards

primary difference between the Factory Method and Abstract Factory patterns?

Factory Method creates a single product, while Abstract Factory creates a family of

related products.

28
New cards

Open/Closed Principle (OCP) relate to the Factory Method pattern

Factory method aligns with OCP by allowing new product types be introduced without modifying existing code.

Instead of changing the factory or client code, new implementations can be added by extending the factory.

29
New cards

to implement a Singleton, but it contains two issues. Identify and explain the problems

public instance and public constructor should be private. synchronized should be used to handle concurrency in the getInstance function.

30
New cards

what is wrong with book code.

Book is not TableOfContents, book contains TableOfContents. So composition should be used instead of inheritance. Fix is to make TableOfContents a member variable inside Book. It is good practice to initialize the member variable using dependency injection. Below is corrected code.

public class Book {

private String title;

private String author;

private TableOfContents tableOfContents;

public Book(String title, String author, TableOfContents tableOfContents) {

this.tableOfContents = tableOfContents;

this.title = title;

this.author = author;

}

31
New cards

distinguishes structural design patterns from other GoF pattern categories?

They emphasize how objects and classes are composed to form larger structures.

32
New cards

What is the primary motivation behind using an Adapter pattern?

To enable two incompatible interfaces to work together without modifying their source code.

33
New cards

best describes the Flyweight pattern?

It reduces memory usage by sharing common parts of object state

34
New cards

How does the Bridge pattern help manage the complexity when a class must vary along two or more independent dimensions (e.g., 3 subclasses for one aspect and 7 for another)

It separates one dimension into a distinct hierarchy using composition, thereby avoiding a combinatorial explosion of subclasses