Object oriented program was developed from modular programming, which came from procedural programming. The antithesis of functional programming is imperative, and includes procedural, modular, and OO.
"Design Patterns: Elements of Reusable Software" is a hard source for more OO information. It''s hard in the sense that''s it''s a book, a hardcover, difficult to read, and difficult to understand.
An important aspect of OO is that you abstract to the invariant, define an interface to transact that behavior, and then use data to handle the variations.
The best example I''ve read is a small example from making pay-roll software. It starts with one case, where everyone is paid once-a-week. This is easy, but of course is inadequate. The software is updated to handle paying employees bi-weekly (every two weeks). A switch handles the two cases. Then contractors are hired that are paid once-a-month, and some part-timers are hired that are paid on a daily basis, etc...
The invariant is that employees are paid acording to some schedule. The interface ought to make no assumptions about the frequency, leaving that detail to a sub-class. A sub-class is made for each type of pay-schedule, daily, weekly, bimonthly, etc... When the HR person is presented with a pay schedule, they choose from an enumerated list of options, that uses a Clone (aka Prototype) method to create the correct pay schedule. No where in the code is there a switch statement handling this process, so the addition of more pay-schedules is
transparent.
...
quote:Original post by Landsknecht
I also realize that no paradigm has wholly replaced a previous one. That is what I said! I am saying that zealots exist and say that oop is the "One True Thing" and that eventually, something else will become the "One True Thing".
Yes, like generic-programming you heathen. :0)
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara