# OOP fanatism
[[OOP - Object Oriented Programming|OOP]] is one way to write code and software among many, and it has its pros and cons. To write code in an [[OOP - Object Oriented Programming|OOP]] manner without considering contexts and needs is an [[Anti-Pattern|anti-pattern]] that lead to worst situations.
```python
# Don't
class EmployeeRepository:
@staticmethod
def get_by_id(employee_id):
with session_maker.begin() as session:
res = session.execute(
sqlalchemy
.select(EmployeeModel)
.where(EmployeeModel.id == employee_id)
).one()
return res
# Do
def get_by_id(employee_id):
with session_maker.begin() as session:
res = session.execute(
sqlalchemy
.select(EmployeeModel)
.where(EmployeeModel.id == employee_id)
).one()
return res
```
For example, it's really easy to do [[TMA - Too Much Abstraction|too much abstraction]] and ends up in a nightmarish design where your [[Method|methods]] relies on other [[Method|methods]] that belongs to parent classes, that itself rely on internal other methods, while mimicking the behavior and names of known methods or functions but with different signature, creating a very confusing design.
---
Bibliography:
- [Title - website.com](need bibliography)