Python OOP & Software Design Principles

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

1/43

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering Python OOP concepts, SOLID principles, Pythonic practices, decorators, generators, testing methodologies, modularization, and layered architecture.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

44 Terms

1
New cards

Object-Oriented Programming (OOP)

A paradigm that organizes code into classes and objects to model real-world entities and behavior.

2
New cards

Class

A user-defined blueprint that bundles data attributes and methods for creating objects.

3
New cards

Object

An instance of a class containing its own state (attributes) and behavior (methods).

4
New cards

Encapsulation

OOP principle that bundles data and methods together while restricting direct access to internal state.

5
New cards

Inheritance

Mechanism that allows a class (child) to acquire attributes and methods of another class (parent).

6
New cards

Polymorphism

Ability for identical method names to behave differently depending on object context.

7
New cards

Compile-Time Polymorphism

Polymorphism resolved at compilation, typically via method or operator overloading.

8
New cards

Run-Time Polymorphism

Polymorphism resolved during execution, usually through method overriding in subclasses.

9
New cards

Abstraction

Hiding internal implementation details while exposing only necessary functionality.

10
New cards

Partial Abstraction

Abstract class containing both abstract and concrete methods.

11
New cards

Full Abstraction

Abstract class (or interface) containing only abstract methods.

12
New cards

Single Responsibility Principle

Each class or function should have one, and only one, reason to change.

13
New cards

Open/Closed Principle

Software entities should be open for extension but closed for modification.

14
New cards

Liskov Substitution Principle

Subtypes must be substitutable for their base types without altering program correctness.

15
New cards

Interface Segregation Principle

Prefer many specific interfaces over one fat interface; clients shouldn’t depend on methods they don’t use.

16
New cards

Dependency Inversion Principle

Depend on abstractions, not concrete implementations; high-level modules shouldn’t depend on low-level details.

17
New cards

DRY (Don’t Repeat Yourself)

Each piece of knowledge should have a single, unambiguous representation in the system.

18
New cards

KISS (Keep It Simple, Stupid)

Favor simple, straightforward solutions and avoid unnecessary complexity.

19
New cards

YAGNI (You Aren’t Gonna Need It)

Implement functionality only when it is actually required.

20
New cards

Zen of Python

A list of 19 aphorisms by Tim Peters guiding Pythonic code style (e.g., “Beautiful is better than ugly”).

21
New cards

Pythonic Principles

Practices emphasizing readability, built-ins, comprehensions, context managers, EAFP, PEP 8, etc.

22
New cards

Decorator

A function (prefixed with @) that takes another function, adds extra behavior, and returns a new function.

23
New cards

Generator

Function that uses yield to lazily produce an iterable sequence, conserving memory.

24
New cards

Decorator vs. Generator

Decorator enhances another function; generator produces values lazily—different purposes though both use functions.

25
New cards

Exception Handling

Using try…except…else…finally blocks to gracefully manage runtime errors.

26
New cards

finally Clause

Part of try-except that always executes, even if an exception occurs or is handled.

27
New cards

Test-Driven Development (TDD)

Development process where tests are written before code, enabling regression prevention and design focus.

28
New cards

Unit (in testing)

Smallest testable piece of code, such as a function or class method.

29
New cards

Mocking

Replacing real dependencies with simulated objects to isolate units during testing.

30
New cards

Integration Testing

Verifies that multiple modules or components interact correctly using real dependencies.

31
New cards

Performance Testing

Assesses system behavior under load, stress, scalability, and endurance conditions.

32
New cards

Load Testing

Measures performance under expected user or transaction volume.

33
New cards

Stress Testing

Evaluates system stability beyond normal operational capacity.

34
New cards

Scalability Testing

Determines how system performance changes as workload increases.

35
New cards

Endurance Testing

Checks system reliability under sustained load over extended periods.

36
New cards

Module

A single Python file (.py) containing variables, functions, or classes for reuse.

37
New cards

Package

A directory containing an init.py file and related modules, enabling hierarchical organization.

38
New cards

init.py

File that marks a directory as a Python package and can execute initialization code.

39
New cards

if name == "main"

Block that runs only when the file is executed directly, not when imported.

40
New cards

Three-Layer Architecture

Separates application into presentation, application (business), and data layers for clarity and scalability.

41
New cards

Presentation Layer

UI layer handling user input/output and formatting without business logic.

42
New cards

Application (Business) Layer

Middle layer containing core processing and mediating between UI and data layers.

43
New cards

Data Layer

Layer responsible for data storage, retrieval, and persistence operations.

44
New cards

Layered Architecture Benefits

Provides faster development, better maintainability, scalability, security, and reliability through clear separation.