[fpc-pascal]Why Oop?

Shifted Soul snsii at yahoo.fr
Fri Feb 22 10:23:41 CET 2002


Every problem can have a multiple issues, but only one of them is the most
adequate.
In the blackjack problem, you can use the structural way of things.
If you want to use structures that have many points which are indentical, you
have to redefine them every time a new structure is needed. In Oop, all you have
is to define them once and then to use the heritage, in this way there is two
advantages :
1 - A spped up of writing the structures and a smaller source file.
2 - A true reusable code : in the structural way you have to redefine the code
of a procedure (or function) to get it use the new structure and then have as
many version of the same procedure as the number of different structures. In the
Oop you don't have to even mention it if you don't want to add anything !
The greatest examples are the GUIs and games which involves many adversers (all
have the same properties and code, and everyone can add its own characteristics
to the general model).
But DataBases are programmed easier in a structural way !
I said this to tell that nothing is perfect, use the appropriate method for
solving a problem.
bye






More information about the fpc-pascal mailing list