About the author Marco Cantu is a well-known Delphi expert. He has published "Proficient Delphi" series, "Delphi Development Manual" and e-book "Proficient PASCAL" (this e-book can be available free of charge). The topic he taught is Delphi foundation and advanced development skills. You can get more information about him through his website (www.marcocantu.com), you can also contact him with his public news group. Please refer to his website for details.
Introduction Most Delphi programmers use their hand to develop tools like Visual Basic, and don't realize the powerful features of Delphi, and more don't talk about these features. (Write here, editing the fearful raise hand, how can it be?) Delphi and Visual Basic, Delphi is fully built on object-oriented structures, which not only affects the structure of VCL, but also affects every one developed using Delphi. program. In this article, I don't want to involve all the theories of object-oriented programming (OOP), just propose some simple experience rules. I hope these rules can help improve your program structure. Regardless of the type of program you develop, these empirical rules are applicable. You should treat them as some suggestions, remember them and apply them to the program you develop. A key principle I want to emphasize is to be encapsulated on object-oriented programming. We all want to create some flexible and strong classes, because such classes allow us to modify their implementation methods without affecting other parts of the program, this is the benefits of packaging us. Although the package is not a single standard for a good object-oriented program, it constitutes the basis of surface object programming, so I may have too much powerful encapsulation in this article, please don't feel strange, I have enough reasons for it. do. Finally, I want to explain such a fact that this article will focus on the development of the form (although some of these rules apply to components), these rules are suitable for all Delphi programmers. The programmers who write components must program the surface objects and classes as the core of the core, but for those programmers who use components, they often forget the object-oriented. For them, this article can be treated as a prompt, reminding them to remember object-oriented programming
Part 1: Form is a class (Rule 1-Rule 15) programmer often treats the form as an object, and the fact form is class. The difference between the two is to create multiple form objects based on the same form class. What is doubtful is that Delphi creates a default global object for each form class you defined. This is quite convenient for novices, but this will also make them form bad habits.
Part II: Inheritance (Rule 15-Rule 20) In the second part, the second part will be some of the inheritance of the class and the inheritance of the class, especially the form of the form, in particular about the form. And skills.