0% found this document useful (0 votes)
2 views2 pages

Oop Solid Python Guide

The document provides an overview of Object-Oriented Programming (OOP) principles and SOLID principles in Python, including encapsulation, abstraction, inheritance, and polymorphism. It outlines the five SOLID principles: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion, with code examples for each. Additionally, it includes practice interview questions related to Python and software design concepts.

Uploaded by

Bruno Brito
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Oop Solid Python Guide

The document provides an overview of Object-Oriented Programming (OOP) principles and SOLID principles in Python, including encapsulation, abstraction, inheritance, and polymorphism. It outlines the five SOLID principles: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion, with code examples for each. Additionally, it includes practice interview questions related to Python and software design concepts.

Uploaded by

Bruno Brito
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

OOP & SOLID in Python - Interview Guide

OOP Summary
Object-Oriented Programming organizes code using objects that combine data and behavior. Main
pillars:
Encapsulation
class Device:
def __init__(self):
self._status = "offline"

def turn_on(self):
self._status = "online"

Abstraction
from abc import ABC, abstractmethod

class Service(ABC):
@abstractmethod
def run(self):
pass

Inheritance
class Animal:
def speak(self):
print("Sound")

class Dog(Animal):
def speak(self):
print("Bark")

Polymorphism
def make_sound(animal):
[Link]()

SOLID Principles
S - Single Responsibility
class Report:
def generate(self):
pass

class ReportPrinter:
def print(self, report):
pass

O - Open/Closed
from abc import ABC, abstractmethod

class Shape(ABC):
@abstractmethod
def area(self):
pass

L - Liskov Substitution
class Bird:
def fly(self):
pass

I - Interface Segregation
class Printer:
def print(self):
pass

D - Dependency Inversion
class Database:
def save(self):
pass

class Service:
def __init__(self, db):
[Link] = db

Practice Questions (EPAM Style)


- Explain difference between list and tuple
- What is GIL in Python?
- Difference between threading and asyncio
- What is a decorator?
- Explain context manager
- What is dependency injection?
- Explain SOLID principles
- What is difference between multiprocessing and threading?
- What is async/await?
- Explain difference between classmethod and staticmethod
- How would you design a scalable system?
- What is REST API?
- Difference between SQL and NoSQL
- What is Docker and why use it?

You might also like