General criterion for component design

xiaoxiao2021-03-06  48

December 14, 2004 22:34:14

Most object-oriented programming tools provide polymorphisms through inheritance. For small-scale development tasks, this is a very effective technology, but this method is problematic in a large-scale system.

More seriously, excessively emphasizing that inheritance drive polymorphisms often lead to a large number of resources from development tasks to the frontier design task, in the end user may find - before the experience of the system - the system has completed the desired purpose, but before There is no resoluntary development task or shorten the time. Therefore, rapid prototype tools and rapid application development (RAD) are more widely accepted than OOP tools.

Visual Basic follows COM, emphasizing that multi-interface is a more flexible way to provide polymorphism. In this way, the software can be gradually developed in an interface, rather than being derived from all necessary precedents through a long design process.

Note that C or other object-oriented users are accustomed to viewing layered structural maps. The layered structure diagram of the class describes inheritance relationships. That is, this picture shows how an object is derived from a simpler object and inherits its behavior. In contrast, the object model is a hierarchical structure that includes the relationship. That is, the object model illustrates how complex objects such as Worksheets include other object sets such as Button, Picture, and Pivottable. You can create object models with Visual Basic, Visual C , and other tools that support COM and ActiveX.

Once the entire object is divided, a method of organizing each component is partially organized. If you divide the Node object from the TreeView control, you can't explain the relationship between them, then you will nothing. The object model can easily provide such an organizational method for the user of the component.

Determine the function of the component to be provided. What is the need to be needed based on the logical function of the part. The form to display the form to display. Each class design interface provided by components-ie class properties, methods, and events. Create a part project and test it. Implement the form required for this part. Implement each class interface, provide a browser string for interface member functions, and add to the help topic. Each additional interface element or function is added to test the code in the test engineering to test the new feature. Compile this part and test it with all possible target applications.

1. A process outside part is a .exe file, run in its own process, and use your own execution thread. Therefore, communication between the client and the processes is called the process or processes. 2. Processes, such as .dll or .oCX files, running with the client in the same process. Since attributes and method scheduling do not have to span the process, the method of the fastest access to objects is provided. However, the internal parts of the process must use the client's execution thread. 3. Control components (.ocx files) are internal parts.

Named learning

The names that access the part are set for the names of the class module and its attributes, methods, and event selection. When naming these elements and its parameters, the following simple rules should be followed to facilitate the use of users.

Use complete words as much as possible, such as "SpellCheck". Abbreviations can have a variety of forms, so it will cause confusion. If the entire word is too long, use its complete first syllable. Use the uppercase mixing to name the identifier, write the first letter of each word or syllable, such as Shortcutmenus or AsyncReadcomplete. When describing a concept, select the word that the user may use, for example, using Name instead of LBL. Name the name of the collection class, such as Worksheets, Forms, or Widgets using the appropriate plural form. If the name of the object contained in the collection is ended with "S", add Collection, such as SeriesCollection after the name. The prefix can be used in the name of the "Naming Constant" in this chapter. Name the order in the order of consistent action / object or object / action. That is, use INSERTWIDGET, INSERTSPROCKET, or the like, or always put the object in front, such as WidgetInsert and SprocketInsert. Important cannot use the following names as an attribute name or method name, because they all belong to the next level of IUNKNOWN and IDISPATCH interface: Queryinterface, AddRef, Release, GettypeInfocount, GettypeInfo, GetidsofNames, and Invoke. Use these names will result in compilation errors.

1. The value of the instancing property determines that this class is private (ie, only within the part), or can be used by other applications.

Private means that other applications cannot access type library information about this class, and cannot create an instance. Private objects can only be used inside the part. PublicnotCreatable means that other applications can only use this object only after the part is first created. Other applications cannot create such objects with CreateObject functions or New operators. MultiUSE allows other applications to create objects of such classes. An example of a component can provide an object created in this way. Process external components can provide multiple objects to multiple client programs; internal parts can provide multiple objects for any other part of its client program and any other part in its processes. GlobalMultiUse is similar to multiuse, only one point: you can call attributes and methods as a simple global function to call. This method does not have to explicitly create objects of this class, which will be automatically created. SingleUSE allows other applications to create objects from this class, but each object of the class created by the client will start a new instance of the part. Not allowed to be used in ActiveX DLL projects. GlobalSingleUse is similar to SingleUSe, except that the properties and methods of this class can be called as simple global functions. Not allowed to be used in ActiveX DLL projects.

Class module and engineering type

The value of the Instancing property is limited in certain engineering types. The value allowed in each project type is shown in the table below:

Instancing Value ActiveX ExeactiveX DLLACTIVEX Control PrivateYesyesyespublicNotcreatAbleyesyesyesmultiUseyesyes - top MultirciUseyesyesyesyeskyes-

转载请注明原文地址:https://www.9cbs.com/read-80682.html

New Post(0)