DEV Community

Discussion on: Please don't write a class

Collapse
 
pancy profile image
Pan Chasinga

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 :)