[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Object-oriented philosophy

Le jeu. 6 sept. 2018 ? 16:05, Michael F. Stemper
<michael.stemper at gmail.com> a ?crit :
> How does one judge when it's worthwhile to do this and when it's
> not? What criteria would somebody seasoned in OO and python use
> to say "good idea" vs "don't waste your time"?

I may qualify as experienced with Python, that being said, "to class
or not to class?" is still an open question.
I have been working on some stuff using Scheme and no OO machinery and
it worked well. Also, mocked
some stuff in the frontend using a purely functional approach. It works.

So, I am wondering what's the purpose of OOP?

Class-based error handling with exception and inheritance is very
handy maybe perfect.

I have been burned by Django class everywhere (ORM, REST, admin UI,
data validation, etc?).

Another place where class shines is when you have the same interface
for different objects.
Like others have said, it's more "duck typing" than OOP. Again
following the "common interface"
an abstract class is helpful and in this case, inheritance makes
sense. But that doesn't require
more that one or two level deep inheritance.

So, in the end, I think that except for error handling and the
subject.verb(**complements) syntax. OOP is dubious.

Multiple inheritances outside mixin anyone? Metaclass outside ORM / ODM?