[fpc-devel] class abstract, class sealed implementation. please review.

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Oct 19 08:40:24 CEST 2009


2009/10/19 Paul Ishenin <ip at kmiac.ru>:
> ...
> TNokiaPhone = class(TCellularPhone)
> TNokia37xxPhone = class(TNokiaPhone)
> TNokia3720Phone = class sealed(TNokia37xxPhone)
>
> TBasicPhone is ofcource an abstract class. It can have some basic fields
> like color, weight, dimensions, ...
> TNokia3720Phone is a final product which can't have any further derivations.
> It is logically to mark this class as sealed to prevent ocasional errors.

Bad example! :-)  I have the Nokia 5800XM. You get that "final model"
in two flavours. Red and Blue (phone color and software theme color).
Then you also get revisions of that phone. Revision 1 had problems
with the speaker. Revision 1.x (or 2.x - I don't know how they
numbered them) have those hardware problems fixed. So it's the same
model phone N5800XM, but it has various differences.

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!



-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list