loading...

re: Please don't write a class VIEW POST

FULL DISCUSSION
 

I mean, while I completely agree that OOP is not a silver bullet, I would be curious as to the algorithm you suggest for Dog... 😜

 

Dog is not a new defintion, but an attribute of mammal in this case.

 

Interface is one way to solve this entity problem. It provides an equally nice abstraction without carrying over lots of baggages. Also composition / mixin is a nice way. In non-OOP languages like Haskell or Erlang, problems can be solved mostly with functions and modules.

What I meant was if the problem's simple, there might not be a need in the first place for Dog to inheriting anything or to even be a Dog (with a capitalized D).

IMO It's better to be wary of writing classes than to jump to it as a first thought. You'd be surprised how meta it can feel to not having to strictly establish something as a definite being :)

Code of Conduct Report abuse