[Lazarus] The Data-Model for SynEdit / The Data Model for Lazarus [Code Structure / SourceEdit and SyneEdit]

Hans-Peter Diettrich DrDiettrich1 at aol.com
Thu Dec 18 23:35:17 CET 2008


Martin Friebe schrieb:

> - The public/shareable model would have to be ref-counted. Or explicit 
> ownership would need to be assigned and the owner would need to keep 
> track of all Shareholders.

The latter. The model must know about all views, to be notified of 
changes. This suggests a viewer chain, as used e.g. for Windows 
clipboard viewers.


> - The Model can be serialized. Special classes would to this work. 
> Therefore a model can be saved to one file, or to a set of files

A separation in multiple classes is dangerous, because changes to the 
model (number or type of values) had to be reflected in all related 
classes, in every project using that model.


> The it would only need an appropriate serialize class to save all of them.

Or an accordingly overwritten virtual method.


> The Model could also carry callback lists, so the anybody who needs to 
> know that it was loaded or saved could register a callback
>   Model.AddOnSerailizedCallback( AMethod )

The beforementioned list of view(er)s. When actions shall be monitored, 
then an implementation in the controller seems to make more sense to me.

DoDi




More information about the Lazarus mailing list