[fpc-devel] Rather large flaw in TJSONConfig component
Graeme Geldenhuys
graemeg.lists at gmail.com
Mon Jun 21 16:45:08 CEST 2010
Op 2010-06-21 16:31, Mattias Gaertner het geskryf:
>
> Now I understand.
> Yes, TXMLConfig has the same "design flaw" as
> TStringList.LoadFromFile/SaveToFile.
> It is strange how you get used to such flaws and think it is normal.
Like I said, if nothing gets changed in the TXXXConfig components, then
Lazarus IDE leaves the door wide open for developers to make this mistake.
Why, because Lazarus IDE has a TXMLConfig component on the component
palette. Developers wouldn't think twice that they are not allow to drop
one component on each form and have a data loss issue.
Possible solutions:
* Fix TXXXConfig components to handle concurrency (multiple instances).
More intelligent file handling.
* Implement a Singleton for each TXXXConfig component which is ready to
use for by the developer. Just like Application and Screen are single
instances in a application without the developer needing to do anything.
* Lazarus could maybe warn the developer (with a popup message) if they
drop more than one TXXXConfig component in a project with same Filename
value.
* Or TXMLConfig must be removed from Lazarus component palette as it's
not like all other components that can handle multiple instances without
problems.
* Or remember to add clear documentation (when it is written) about this
pitfall with TXXXConfig components.
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/
More information about the fpc-devel
mailing list