[fpc-pascal] Implementing Factory Method with Pascal

Marcos Douglas md at delfire.net
Sun Nov 29 03:20:42 CET 2015

On Sat, Nov 28, 2015 at 3:31 PM, Marco van de Voort <marcov at stack.nl> wrote:
> In our previous episode, Marcos Douglas said:
>> 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
> Such rants are in direct opposition of GoF. GoF never meant to push a set of
> unbendable rules. They just wanted to standarize jargon, and describe
> somethings they encountered (without any claim that everybody should use
> it).

I only chose two links to put into the email. There are many other ...
I just pointed some examples because they have examples.

In my GoF book (Portuguese version), page 34, says:
...It is often said that "inheritance violates encapsulation"...
[free translation]

Page 35:
"Preferably the object composition instead of class inheritance."
[free translation]

> Aside from the fact that interfaces is still inheritance.

This is different. There is no behavior, only a contract.

More information about the fpc-pascal mailing list