More recently, perhaps because I was supporting some old code, I began to look at how / why I was doing something. How do you do it.
Most of my Delphi programming was done in-house or with examples scattered across networks or manuals. And in some cases, this is done only because "the way I do it"
What I am asking now is the declaration of variables, procedures, functions, etc.
When I work with a form, I put all my procedures and functions in the public or private . Although I will try to avoid global wars, and the constants will usually be under var or const , either in the interface or in the implementation, depending on where they should be called (sometimes they will be publicly / closed)
Otherwise, if its just a unit, I will declare the procedure in the interface and use it in the implementation. Some of the code that I have been supporting lately do not have an interface declaration, but instead have all correctly ordered calls after the procedures ...
Is there a proper way to do this? Are there rules for what should / should not go in a class? Or is it a style / when did you start the business?
Edit to add
My question is not whether the procedure declaration is private / public, but whether all declarations in TForm Unit must go in one of them. Similarly, if var / const will be in one or the other?
Further refinement
I understand that not a declaration in the interface or a declaration in public / private / etc affects the visibility of procedures / functions for other units in my application.
The core of my question is: why do not I want to announce? - especially when working in uniform / unit when placed in private, it is much more clear that the claimed item is not available for other units ...
Cheers Dan
source share