Some questions about Borland C ++ Builderx

zhaozj2021-02-08  313

Zuo Lou 2003.10.20

During this time before and after Borland released C Builderx, I saw a lot of discussions about C Builderx (hereinafter referred to as CBX) on CBS. As the engineer of Borland Chinese company responsible for rapid development of tools and developer community, I think I need to answer some questions and guessions. It should be noted that I didn't get the official authorization of Borland to do this. Therefore, the following text is not necessarily equivalent to the official view of Borland; I just take some things from my perspective, try to do with you communication. If there is a mistake or improper, please refer to you.

CBX born background

As I see, online on CBX is mainly concentrated in these aspects: What is Borland to develop CBX, what is the relationship between C Builder? What is the relationship between CBX's Framework, what is the relationship with VCL? What is Borland's positioning and long-term plan for CBX? To answer these questions, you must first start from the background of developing CBX. As you know, Borland released a range of new products in 2003, there are three in the development tools of the Windows / .NET platform: delphi.net, C # Builder and CBX. The launch of these new products, indicating that Borland has changed and differentiates in the development tool camp under the Windows platform. These changes have occurred, and it is rooted on a profound revolution in the operating system itself, ie the comprehensive transition from the Win32 platform to the .NET platform. According to my opinion, many technicians in China still do not have enough understandings for this transition. In short, Microsoft has made up our determination to fully turn the operating system from Win32 to .NET; Enterprise-level servers, to the desktop system, to the embedded system, .NET will be a unified programming model in the Microsoft solution. Although this shift is slow, it is difficult, pain, but this is the direction of historical trends. Whether you like, unless you give up on the development of the Microsoft platform, you can only adapt it. This transformation brings great challenges to the development tool manufacturers of the Windows platform, and Borland is no exception. The current situation is similar to that of the transition from DOS to Windows, and the entire operating system and programming model have happened to change. Borland's Delphi and C Builder are deeply rooted in the Win32 platform. In the face of this transformation, a positive response must be made to survive and develop. Borland did make this reaction. As everyone can see, Delphi's direction is to turn to the .NET platform with the operating system, its result is the birth of delphi.net, which will be together with the new C # Builder, becoming the main force under the .NET platform development tools. (But Delphi still retains the ability to develop under Win32 because applications under Win32 platform will continue to exist in the future.) As for the direction of C Builder, discussion inside Borland, As a result, everyone should have guessed, that is, C Builder is not close to .NET, but insisted on the path of the original development tool, and expanded to multiple platforms, multiple compilers. It turned out that C Builder and Delphi were developed by the same RAD development team, which is also one of the reasons why C Builder and Delphi always alternately upgrade. After making this decision, Borland has established a new C / Mobile development team, C development tools from this and Delphi. Why did Borland make this decision and have a variety of reasons. First, the native C / C development is still one of the most important markets.

On platforms other than Microsoft, whether it is the server's UNIX / Linux, or more and more popular embedded systems, C / C is still a language to pick up the beam. Even under the Microsoft platform, after the transition of .NET is completed, C / C is still irreplaceable in certain underlying development. Review Borland C 's glorious history, looking forward to the future strategic layout, Borland can't give up this market. Second, the C language has its particularity, not suitable for .NET transplantation. Friends who are familiar with the .NET platform may know that many features of Delphi are quite similar to the C # language, from the object reference model, to a single inheritance structure, and the PME (Property, Method, Event) model, all this (after all, C # and Delphi are from the same Hand of Anders). Delphi is extended and adjusted to meet the .NET CLS (Common Language Specification) and will not harm the Delphi style, which is conducive to a more powerful Delphi. And C has a completely different development idea. If you want to match CLS, you must make a large modification of C , the result is that C is no longer C . The Managed C provided in Visual Studio .NET is not universally recognized in the C community, it is an example. In this case, C Builder is not turning to .NET but also a way in which it can be used, and it is impossible to say a wise move, and it may even be the only choice. Compatibility and VCL

The downward compatibility of CBX, especially compatibility with VCL, has a highly attacked problem online. This problem can be explicitly answered as follows: In CBX, there is no VCL. CBX built-in Framework is a brand new, 100% developed by C , cross-platform Framework, where the GUI section, a third-party cross-platform WXWINDOWS component library (GUI and corresponding RAD functions are not available in CBX 1.0 It will be provided in 2.0). Due to historical reasons, the Framework for C Builder uses Delphi's VCL. This makes C Builder programmers often find itself in a quite embarrassing situation: he has to deal with the Framework written in another language. Moreover, in order to compatibility with VCL, the non-standard syntax like __property is added to the C Builder, so that C Builder looks like a Delphi replica. Therefore, there is a saying that "BCB's master must be Delphi's master". Starting from the day of C Builder, it has not stopped using C to write the entire framework. The birth of CBX has made this wish, and this Framework even exceeds our expectations: it not only uses standard C writes, but also supports cross-platform and cross-compilation (Cross Compiration, which is compiled under one platform to generate another platform. The executable code is also available on certain professional areas, such as embedded development, and for certain major areas. In addition, it is convenient to attach a third party C library such as ACE, LOKI, Boost. However, this change is also unfavorable, that is, CBX is no longer compatible with VCL down. This is why many technicians expressed dissatisfaction, because the original C Builder has been inseparable from VCL, CBX abandoned VCL, will cause the programmer of C Builder to re-learn new Framework and give the original code The upgrade brings a lot of trouble. Many questioning points to the same question: Why does Borland does not achieve a smooth transition of VCL to C ? This problem is indeed a big problem, which can be traced back to the original Borland when developing C Builder, why don't use C to develop your own Framework, but I don't hesitate to modify C , let it use the VCL written by Object Pascal; Why didn't rewrite the VCL in C in the six versions of C Builder, and even involve Delphi's design ideas and the difference between C and Object Pascal. It is generally believed that Borland was originally due to the pressure of time and funds, and the C Builder was married to the Object Pascal-based VCL. I have also held this point of view, but later gradually learned Delphi and C , slowly discovered that this move may have more important reasons, that is due to the difference between C and Object Pascal, transplant VCL to C has difficulties in almost impossible.

Take the so-called "virtual constructor" as an example, in C , the constructor cannot be virtual. Dr. C Parent Bjarne Stroustrup has been discussed for this issue: "Virtual call is a mechanism that works in the case of giving information incomplete information. Special, virtual allows us to call a function, For this function, just know its interface, and don't know the specific object type. But to create an object, you have to have full information. Special, you need to know the specific type of object to be established. So, the constructor The call cannot be virtual. "But in Object Pascal, the constructor can be virtual." The reason is that Object Pascal's object model is different from C . In Delphi, there is a so-called "class type" (TCLASS), which is a class that describes the related information of the class, similar to the Type_info class in C , but is much better than the latter. More importantly, Object Pascal decides to create objects based on class types, through this mechanism, it avoids "given information incomplete", which easily implements virtual constructors. At the same time, this mechanism has also led to huge differences in RTTI in Object Pascal and C : RTTI in standard C can only get class name (the compiler can provide additional RTTI support, but very limited), and RTTI in Object Pascal Not only can you get class names, class inheritance relationships, object instances, and information such as properties, methods, events, etc. This RTTI in Delphi is similar to the REFLECTION in Java / C # or maybe it may be, the Reflection in Java / C # is affected by Object Pascal. Object Pascal can do this, inseparable from its single inheritance structure: Because all classes in Object Pascal are inherited from TOBJECT, it can easily add RTTI information. At this point, C and it have the difference in essence. In the source code of the VCL, a large number of techniques for the class type and virtual construct are used to build a huge inheritance tree, while powerful RTTI is the foundation of the entire Delphi component model. As mentioned above, due to the difference in language of Object Pascal and C , it is necessary to rewrite the VCL with C , and it is impossible to do things. In the end, this is already the difference between the two different programming ideas of the industry, not simply compromising to be reconciled. Let us put this in a larger historical background. When Anders developed Delphi, it was C to grow rapidly with OOP ideas, while the Pascal language is getting rumored. Anders not only broke through standard PASCAL restrictions, but introducing OOP into new Object Pascal, and some issues exposed in practice in practice, consciously make up and improved to build a new generation of Framework. The crystallization of this action is the birth of VCL. In fact, many experiences of Object Pascal / VCL, later followed by Java / C #, used to build components architectures in J2EE / .NET. From this process, we can see the evolution of programming ideas and programming languages. Of course, this is not said that C has not yet falling.

In fact, C has always been continuously growing, the above problems may have other solutions. With the "virtual constructor", Stroustrup himself pointed out that it can be indirectly implemented by factory pattern. Build a Framework like VCL with C , it can be done, but the product is implemented, and the VCL large phase of the Object Pascal is definitely written. In fact, this has been far from the original intention of C Builder programmers. I think this is the pros and cons of Borland, and finally harm the compatibility of C , marry C Builder to the main cause of VCL. After taking into account these factors, the VCL has not been understood by continuing their lives in CBX. Another important reason is that VCL is developed on a Windows platform, so many places only consider integration with the Windows platform. Since Borland has already decided to stovetitter, build a complete cross-platform C development tool, naturally, this opportunity, get rid of the relationship with VCL, and replace it with a new, 100% C Framework. Idea

CBX will use JBuilder IDE, which has now been confirmed. Why is C development tools to use a IDE written with Java? This is also a place to question many friends. CBX selects JBuilder's IDE, at least partially due to the needs of Unified IDE. As we all know, Borland has a platform-neutral vendor, with its own development tools on many platforms. With the development and differentiation of these development tools, unified IDE is already an inevitable trend. It is alleged that Borland will only maintain two basic IDEs, namely .NET-based Galileo and Java-based Primetime. C # Builder and Delphi.net are based on the former, JBuilder is based on the latter. As a development tool for cross-platform as an important feature, CBX is selected as an IDE as an IDE. In fact, when we let the eyes are wide, we will easily find that unified IDE has become a trend in the industry. Microsoft provides a unified IDE in Visual Studio.NET while supporting VC #, VB.NET, and VC . Net and other languages. The Java IDE project Eclipse under the host of IBM claims in the future will be important as an important direction with CDT (C / C Development Toolkit, C / C Development Toolbox). Sun's NetBeans have previously incorporated C / C into supported ranges. It can be said that the IDE running on the managed code such as Java / .NET is used as the development environment of the C / C , not the first creation of Borland, but instead of conjunction with the trend. In addition, in my personal opinion, JBuilder's IDE is indeed much better than Delphi / C Builder. Although JBuilder has a slow speed, it is guaranteed by hardware conditions, its CodeInsight, Code Template, and Refactoring are better than Delphi / C Builder, not to mention UML support and TOGETHER. Edition for C integration. Therefore, I think CBX borrows JBuilder's mature IDE, it is a good thing. C future

Let us temporarily leave the CBX to see some things in the C language itself. There is no doubt that C is still one of the most important industrial language standards. Especially in recent years, C language has flourished, and various new technologies and new concepts have emerged, and the C community in the world is also booming. However, do not say, the status of C is indeed a powerful challenge from Java / C #. In the field of application, especially in the high-end applications, Java is gradually replacing C into mainstream. The reason why this is diverse, but the most important reason has two. One is the standard for C is too late until 1998 ISO C standard is officially launched. Before this, the C version of various styles has been wasted in the internal consumption, and the large-scale market gave Java. Another more important reason is that although the ISO C standard has unified C language, but there is no unified C Framework. Although the C advertised language is a platform-independent language (it is indeed), it has a variety of solutions for the same problem. C its own standard library is just a language of Framework, not an application's Framework: on common issues such as I / O, multi-thread, socket, gui, data object model, etc., developers have to package specific platforms. API, either look for a third-party library that is difficult to ensure quality. There is no uniform Framework C , like Delphi without VCL, no JAVA, no JFC, no .NET Framework's C #. Therefore, it is not surprising that C is unable to compete with Java / C # in the application field, and gradually stepped from the bottom programming. In October last year, Dr. Bjarne Stroustrup visited Hua, I used to presented this question to him: Why does C does not have a unified, cross-platform, facing Framework? Does the C standard library works to this way? Dr. Stroustrup answers this question seriously. He said that with Delphi, Java, C # is different, C is a language of manufacturers, and its standard is in the ISO C Committee. This ensures the purity of C , but it also leads to no manufacturers to invest in a large number of resources to develop a unified framework, even if there are manufacturers, do not necessarily ensure its authority. Finally, he suggested that I can consider using some excellent third-party libraries. Since this problem involves a lot of technologies, even involving the goals and positioning of C itself, it seems that there is no better solution. Who knows how long it has long, and things suddenly have turned. Borland's C Builderx is not trying to play a such role? From the background, Borland's development tool manufacturers in the old cards, the technology and experience in the development of C compiler and Framework are unpublished. Borland's largest competitor Microsoft has significantly transferred gravity to .NET and C #, will not significantly develop the native Visual C , and will not develop the application-oriented C Framework.

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

New Post(0)