DEV Community

Discussion on: OOP vs Functional Programming

Collapse
 
rhymes profile image
rhymes

Both.

Though the more time I spend programming, the more I prefer what @kspeakman described as "Static plain FP".

If I look at my Python code over the years, in the last few of them most of the code is functions receiving values and returning other values. There are side effects (like I/O) but there's little to no shared state.
They sit in modules (which are slightly different concept than Ruby modules) and that's it.

Everything in Python is an object (functions and modules too) which makes it easier to use dependency injection to pass around things.

I would call this style: functional programming on top of object oriented programming.

Hence both :-D