

Module Oriented Programming: An OOP Alternative? - Floopsy
http://www.floopsy.com/post/32582236678/module-oriented-programming-an-oop-alternative

======
sparkie
Either I'm lacking sleep, or this is really silly.

1\. The key thing you don't seem to understand about OOP is that it decouples
actual data ("Floopsy", 38) from the meaning of the data (name, age). The
meaning can be applies across all conceivable 'instances' of a Rabbit.
However, you appear to have tightly coupled a "Floopsy",38 and Rabbit. How
would you define another rabbit "Flapsy", and not have a conflict with the
name "Rabbit". How are you going to create new rabbits given an external data
source?

2\. Your example is flawed here, because you would use composition over
inheritance for this in OOP anyway. Inheritance should be used _only_ for
"is-a" relationships. If you've been using it for "has-a" relationship - throw
away whichever book told you to do so.

4\. With the loss of abstraction, you lose _polymorphism_ \- the ability to
use the same piece of code on different types. Either that, or your language
will use duck typing - now you have another problem.

5\. Your ScoreCard module here is doing exactly the same as a static class, or
class with all static fields would be doing anyway - you've not solved any
problem - it's just polishing global state in a pretty box.

~~~
Floopsy
Thank you. No, you are not lacking sleep. This is why I fail as a programmer.
:)

