[fpc-pascal] Implementing Factory Method with Pascal

Michael Van Canneyt michael at freepascal.org
Sat Nov 28 20:34:10 CET 2015



On Sat, 28 Nov 2015, Marcos Douglas wrote:

> Inheritance breaks encapsulation. This was written even in GoF Patterns.
> There are many post, on the web, explaining why inheritance is evil.
> I searched on Google right now:
> http://blog.berniesumption.com/software/inheritance-is-evil-and-must-be-destroyed/
> http://www.javaworld.com/article/2073649/core-java/why-extends-is-evil.html
>

A perfect example why 90% of internet (and in particular blogs) are a waste of bandwidth.

>From the silly-example-department: (a close cousin of the "ministry of silly walks")

A dog *is* an animal, a dog does not *have* an animal.

However (and now it gets tricky): 
A human can have an animal (e.g. a dog), but she *is* also an animal.

On top of that, (s)he can inherit things from his ancestors. 
(for example AIDS or some other nasty disease. Or several millions of dollars)

!! OMG !! Maybe we just discovered a new form of multiple inheritance... 
Definite proof we should all use C++, or maybe it is time for C+++ !!

Please...

There is no golden rule which encapsulates (sic) all situations.

People should use their brain and choose a pattern or methodology judiciously, 
instead of wasting other people's time with stupid rants on blogs.

Michael.



More information about the fpc-pascal mailing list