Florian Gilcher
4/24/2008 11:54:00 PM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Apr 24, 2008, at 11:40 AM, Martin Vales wrote:
> Hi:
>
> I have always had a doubt about OOP.
> Usually we have a parent and several child, but what happen if we need
> the inverse system. for example DBI/DBD APIs.??
Actually, thats quite a common problem of thought, because inheritance
is often considered
as _the_ problem solver in OOP. But that is not the case. I for my
part seldomly inherit.
The core feature of OOP is composition. So even without modules, you
could just implement
a class that has a certain set of features and hands everything else
to a class that has a
concrete implementation for that task (delegation, btw. ;) ).
Depending on the language, this can get large because of the vast
amount of
boilerplate code you have to write for the delegating methods, but in
Ruby, this is a simple task.
Regards,
Florian Gilcher
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
iEYEARECAAYFAkgRHZ8ACgkQJA/zY0IIRZbPZgCgp/Vx54NYWH6PppPXRENXic3s
OwEAn2SFwl0BnIJsu+fvc4+RUBlUGbn/
=tD69
-----END PGP SIGNATURE-----