[fpc-devel] class abstract, class sealed implementation. please review.
Thaddy
thaddy at thaddy.com
Tue Oct 20 10:07:36 CEST 2009
Florian Klaempfl wrote:
> Vinzent Höfler schrieb:
>
>> Florian Klaempfl <florian at freepascal.org>:
>>
>>
>>> Marco van de Voort schrieb:
>>>
>>>> In our previous episode, Florian Klaempfl said:
>>>>
>>>>>> This is exactly my point about sealed classes. When you design the
>>>>>> product or class, you have NO way of know what will come in the
>>>>>> future. So you need to stay flexible to change! Yet another OOP
>>>>>> principal that "sealed" tries to prevent!
>>>>>>
>>>>> This might be true, but what's the difference with private etc.?
>>>>>
>>>> Private is typically used in nearly every class, sealed in exceptional
>>>> cases. At best.
>>>>
>>> I meant regarding "flexibility". Declaring a member private makes things
>>> also less flexible.
>>>
>> The main difference is that "private" restricts visibility,
>>
>
> It's not only not visible but neither accessible. And if something is
> not accessible, it affects flexibility.
>
>
>> whilst "sealed" restricts extensibility. The former is usually a good thing, the latter not.
>>
>>
>> Vinzent.
>>
>>
>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.422 / Virus Database: 270.14.22/2446 - Release Date: 10/19/09 14:33:00
>
>
There is a strange kind - from an academic point of view - of discussion
going on here.
- one part is confusing language syntax with compiler optimizations
- another part is driven by not understanding why somebody invented sealed
classes.
The first is or maybe a side effect.
The second should be understood to be restrictive on purpose, by design.
I think a lot of people whom I highly regard are focussing in the wrong
direction. Sealed has a purpose and a very good one: It prevents OO
extensions by design, which is a good thing. see my example from two
days ago. And, Marco, this is fully compliant with a true OOP philosofy ;)
just my 2 c
More information about the fpc-devel
mailing list