On 6 November 2011 22:28, Frank Church wrote: > If that is the case then a lot of Free Pascal and Delphi demos are teaching > bad practices because they make most members accessible externally when > there is no real reason to. I never thought about that much because I just > wanted to get my apps working rather than think about proper OOP practices, > especially in the case of UI objects like forms, controls etc
Correct, but that is what Borland, CodeGear, Embarcadero and Lazarus call "RAD development". I consider RAD just great for prototyping, not for real-world apps that need to be maintaing my many programmers over a decade or two. RAD promotes a lot of bad habbits: bad OOP design by making everything public, mixing business rules in the UI code via easy event handlers in a form etc etc. The major problems comes in due to the Form Designer in Delphi and Lazarus. The Form Designer solely works due to RTTI, and for RTTI to work you need Published properties - thus publicly visible to all. This is why the fpGUI's UI Designer doesn't use RTTI. So by default all components I drop on a form are in the Private section of the form class. I then make specific data captured by a form public via public or published properties - I never move components like TEdit or TMemo to a public section in a form class. Like you said, that is terrible OOP design! Maybe the form designer in the latest Delphi can now be improved because RTTI was recently extended and can now see more than just Published properties. FPC doesn't support this yet. -- Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal