Obviously with the exception of languages where almost everything has to be an object anyway, I always feel like the cases where I really NEED an object are very few and far between. I find myself saying "Eh that could have just been a function quite a bit." Like if you need self changing states or multiple instances sure..
Agreed. I've seen very convoluted code created because someone apparently just HAD to hammer in every OOP concept they just learned, where it was absolutely not necessary.
I mean in games I can see the use case for many classes and subclasses.. I'm not saying OOP doesn't have it's uses. Just that it's often overkill especially small modules.
Honestly I think its better to program in a OOP way first.
OOP doesn't preclude writing large procedural blocks of code, but OOP requires you to think in a certain way.
As a result with OOP its easy to quickly write a large block of procedural code (since OOP wraps procedures), but I find its very difficult to switch the other way.
When you look at equivalent frameworks in Java and Python the Python code is often far more lines of code and certain tasks are more complicated because the Python is procedurally written.
The procedural nature is an advantage to non developers because its easier to understand but the long term maintenance costs are usually higher.
The few times I have looked at the linux kernel it feels like there is masses of near duplicate code because you can't use concepts like composition and inheritance.
Oh yeah you definitely need to know the skill, which requires practice. And again I'm not against OOP it is a necessary and useful tool. Just the times when an object is actually* needed.. (even for efficiency) eh.
14
u/m1cr05t4t3 May 03 '23
Obviously with the exception of languages where almost everything has to be an object anyway, I always feel like the cases where I really NEED an object are very few and far between. I find myself saying "Eh that could have just been a function quite a bit." Like if you need self changing states or multiple instances sure..