Comprehensive discussion on PB code reuse

xiaoxiao2021-03-06  85

In the era of object-oriented programming, code reuse is a topic that is always worth discussion. About the reuse of PB code, many people have mentioned, but I think some view is inappropriate, how to improve the reuse of PB code, I talk about my opinion.

The first thing to say should be how to reuse the code inside the PB program. This is more familiar, that is, 3 key keys for object-oriented programming: inheritance, packaging, polymorphism. I believe how people have been familiar with the PB for a while Do these 3 points, inherit, packaging does not say, polymorphism can also be achieved by function overloading.

What is said in a program project is how to reuse the code, that is, these code is the source code. How do I use the existing PB code resources for the non-original code? The most common use should use PBD.

In the development environment, the PBD should be the most common method, that is, the PBD library contains the library list of the development environment of the PB. At this time, the objects in the PBD can be called like the objects in the PBL. The function of the function is. At this time, PBD has no difference in the source code, and the other aspects and PBLs are not different. When compiling the entire application, they will also participate in compilation.

The second application method should not contain the PBRARY LIST that will contain the PBRARY LIST, but when the program is running, the PBD is included in, using the PB's getLibraryList, the function of SetLibraryList. This method is specially independent PBD special Be applicable.

In the third way, it is relatively useful, that is, use PB's Automation Server, first compile the PB program into the PBD of Automation Server, then operate it with OLE objects with OLE objects. For PB programs, call it is unnecessary Because it can be called in other ways, it is more simple and efficient. However, its advantage is that this PBD can be called by VC , VB, BCB, because OLE support is supported by most development tools, so Programs developed by PB can be reused in other languages ​​developed.

The fourth way is more advanced than Automation Server, that is, using COM / COM components. COM / COM component technology will gradually replace OLE technology. The same COM component can be reused by other languages, while COM components can also realize remote Call, thus construct a 3-layer application.

Finally, if you use the Easerver to develop 3 layer applications, you can publish the PB code to the Easerver component.

In the end, the code resources of PB have long been useless, through many ways, it can be used by other languages, I think everyone's views should also be changed.

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

New Post(0)