Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Do polymorphism not classes

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.
Avatar for gozala gozala
October 05, 2012

Do polymorphism not classes

Classes are mechanism for polymorphic dispatch with lot's of issues. Maybe we should just use polymorphism & forget about classes.

Avatar for gozala

gozala

October 05, 2012
Tweet

More Decks by gozala

Other Decks in Programming

Transcript

  1. Why OOP Sucks! Joe Armstrong http://www.sics.se/~joe/bluetail/vol1/v1_oo.html • It was thought

    to be easy to learn. • It was thought to make code reuse easier. • It was hyped • It created a new software industry.
  2. • Designed with perfect world in mind. • Have expression

    problem. • Mixing data with functions http://en.wikipedia.org/wiki/Expression_problem Classes
  3. Implement functions that operate on abstraction isWatchable.define(Watchable, function() { return

    true }) watchers.define(Watchable, function() { return this.watchers })