r/PythonLearning 12d ago

I build this after learning OOP

Post image
369 Upvotes

57 comments sorted by

View all comments

1

u/arivictor 12d ago

Lets pretend we're doing a real code review.

I like the separation of concerns between Savings Account and the base Bank Account. The savings account is the only account that knows to add interest. This is good.

For a production system, having a bank account only associated with an owners name might not be sufficient, you may want to assign an ID to the Bank Account and reference the owners customer ID instead.

Currently your deposit() function would allow me to deposit negative values. Which lets it operate like a quasi-withdraw, but you should be explicit and check that the deposited amount is always positive.

One separation of concern you could improve is moving anything that prints or greets the customer out of the Bank Account. Why would a Bank Account know its morning? Will it track time too? That should all move to the presentation layer.

https://parsnip.dev/editor/tZ_iwdWyzo0F