Why Class?
I really like Hadi's criticism of OO, and in fact I would like to hijack it and take it a few steps further, to paint what in my mind is a more realistic picture. Functional programming is only <i>an alternative choice of paradigm</i>. Expert programmers will use the best tool for the job and eschew the pointless search for the <i>absolute best</i>.<p>Why OO? Classes exist to decouple behaviors from data. In fact, their purpose is to think in terms of cohesive sets of behaviors instead of data-driven functions.<p>Does this apply to any possible case? No, it's a leaky abstraction.<p>Why FP? Functions exist to decouple behavior from other behavior. In fact, their purpose is to think in terms of completely decoupled sets of behaviors instead of cohesive functions.<p>Does this apply to any possible case? No, it's a leaky abstraction.<p>Why AOP? Aspects exist to decouple behaviors that apply across classes. In fact, their purpose is to think in terms of orthogonal sets of behaviors instead of hierarchical sets of behaviors.<p>Does this apply to any possible case? No, it's a leaky abstraction.<p>Why Procedural Programming? To separate the functionality of the application in separate behaviors. In fact, the purpose of procedures is to think in terms of behaviors instead of sequences of operations.<p>Does this apply to any possible case? No, it's a leaky abstraction.<p>Why Declarative Programming? To express solutions in terms of goals instead of behaviors. In fact, its purpose is to think in terms of desired state, not sequences or compositions of behaviors.<p>Does this apply to any possible case? No, it's a leaky abstraction.<p>Why Logic Programming? To explore the logical consequences of given facts, instead of focusing on behaviors or desired outcomes. In fact, its purpose is to find new truths starting from given truths.<p>Does this apply to any possible case? No, it's a leaky abstraction.<p>Why spaghetti code? Wait, no that's just crap ;-)