Answer "Talk about Delphi VS VC " ---- Poke Breaking the lie
Recently, I read "Talk to Delphi VS VC " in 9cbs, and I recommend "very exciting" by Mr. Jiang Tao. I adhered to the concept of Bjarne, I didn't want to intervene in the prospective and disadvantage of the program language, but I had to say a few words. As the habit of industry language, the author of course, is the "unbiased" posture at the opening. However, the facts, but as always, people are disappointing: "Sixth I am Taking Me" known to the school people, and once again at the IT ribbon. "Sixth I'm" in the academic circle is a mouse that everyone shouted, but in the software industry, this kind of raw material is arbitrarily distorted, and it is ushered in the behavior of his own point of view, but it is surprised. For the shortcomings, please ask your friends to look at the illusion of the authors.
I: Compiler compiler, as a programs reality, often the success of the language itself, is a decisive role. Special popular compilers tend to be synonymous with language in people's hearts and language itself. Naturally, "reproduces" text data is detailed in detail, after all, "Borland's compiler is the best". However, is the detailed data of the author trusted? Let us look at the author's statement to the code generation length:
"In fact, Delphi / C Builder is in the case of dynamic connection or static connection, the generated procedure is smaller than VC . For example, MDI examples: Selected new ... | Projects | MDI Application in Delphi / C Builder, in VC uses MDI App Wizard; generated program function is very similar. The following is the comparison result: (Delphi Open Optimization, C Builder Using the maximum speed optimization, VC 5 Using the minimum code optimization) Delphi 3 Delphi 5 C Builder 5 VC 5 Dynamic Link 21K 35K 44K 70kStatic Link 253K 398K 467K 490K "
What is the result of the author test? ? VC6.0 code minimum optimization: (no document / view support) Dynamic: 24K maximum speed optimization: (no document / view support) Dynamic: 24K code minimum optimization: (no document / view support) Static: 256k maximum speed optimization :( No document / view support) Static: 256K code minimum optimization: (with document / view support) News: 28K maximum speed optimization: (with document / view support) Dynamic: 32K code minimum optimization: (with document / view support) Static: 288k maximum speed optimization: (with document / view support) Static: 292K can be seen, "re-" literary data has something to lose. Naturally, there will be friends pointing that this may be VC5 differences in VC6. I don't have VC5, but I can tell you that due to the impact of the MFC library itself, the version of the quarter connection of the version 5.0 should be larger than version 6.0. Dynamically connected, even considering the tremendous progress of optimization technology, it will not have multiple reduction in the same order. Let's take a look at the code generation quality of "reproduce". Here, the author gives the comparison of three compilers:
(1) Object Pascal: procedure foo; var i, j: integer; begin for i: = 0 to 15 do j: = j i; end; (2) C void foo (void) {INT i, J ; For (i = 0; i <16; i ) j = j i;}
Delphi 3 generated code (open optimization): byte clock cycle 00424AA9 33c0 xor Eax, EAX 100424AAB 40 Inc EAX 100424AAC 83F810 CMP EAX, 0x10 100424AAF 75FA jnz -0x06 0 (can be parallel) --------- ------ 8 3C Builder 5 generated code (maximum speed optimization): 00401535 33C0 XOR EAX, EAX 100401537 40 Inc EAX 100401538 83F810 CMP EAX, 0x10 10040153B 7CFA jl -0x06 0 (can be in parallel) --- -------------- 8 3
Visual C 5 generated code (maximum speed optimization): 27: for (i = 0; i <16; i ) 00401205 MOV ECX, Dowrd PTR [J] 100401208 xor Eax, Eax 0 (can be parallel) 28: { 29: J = J i; 0040120A Add ECX, EAX 10040120C Inc EAX 10040120D CMP Eax, 10h 100401210 JL Foo (0x0040120A) 0AH 0 (can be in parallel) 00401212 MOV DWORD PTR [J], ECX 0/1 (depending on Branch prediction of a directive) 30:}; ----------------- 16 4.2 (assuming branch prediction accuracy 80%) VC 5 minimum code optimization generation also has 11 words Section: 27: for (i = 0; i <16; i ) 00401205 xor Eax, Eax 128: {29: j = j i; 00401207 Add dword PTR [J], EAX 10040120A Inc EAX 10040120B CMP EAX, 10h 10040121E JL foo (0x00401207) 7 0 (can be in parallel) 30:}; ----------------- 11 4
I am not familiar with the assembly language, but it can also be seen that the code generated by the author listed, and the speed advantage of more than 33% of the VC. However, do you test right? As you can see from the assembled statements listed in the article, when the code is generated, the VC compiler is in the Debug mode. As we all know, DEBUG needs to ensure that the language is related to generating code, so a lot of optimization options will not work. Because of personal ability, I can't give assembly code in Release mode, I hope that friends who are familiar with compilation can be complemented. As for Jake's Code Efficiency Challenge, I said that I will never believe that the Delphi site is evaluated to Delphi. As I don't believe that VC sites are the same for VC's evaluation, what about you? Two: Language characteristics are undoubted, language characteristics are the essence of programming language. Choose a language, or not to select a language, whether the language you need to use may be the most powerful reason. "Rethinking" in the following aspects: (1) Pre-processing, macro, and .h file first look at "re-" article:
"Object Pascal does not support pre-processing, in fact, it is not necessary. Compiler that cannot be directly compiled," "As for macro and .h, it should be said to be garbage characteristics, just due to compatibility It is clear that it is clear in the .ansi / ISO C / C specification: "Do not use Macro and .h, you should use the constant definitions and functions in the program." This is true, pre-processing is indeed, EFFECTIVE C The first one is: "prefer const and inline to #define". But the .h file I hold the attitude, after all, separate the statement and implementation, is a more elastic programming style.
(2) Collection, subcord type
"C does not support these Object Pascal's native types (compilers can be directly identified). However, you can simulate them with classes. After all, the C object structure is the most complex flexible (except ADA). However, performance is lost."
(3) Enumeration type
"Object Pascal does not support each enumeration element specified value."
(4) array
"C / C does not support the array specified in Object Pascal, and the subscript can only start from 0."
(5) Structure "Object Pascal does not support Struct"
(6) String
"String Processing is one of the strengths of Object Pascal" "String / Ansistring in C is simulated by class, so performance ..."
(2) (3) (4) (5) (6) is involved in data type issues. It is well known that the richness or no data of the data type will greatly determine the language of language. The native type of C is not rich in Object Pascal, which is no doubtful. However, as the author's words, C has the most flexible secondary type mechanism, so that words are not limited. (5) indicates "Object Pascal does not support struct". In fact, in C , Struct is identical to the Class except in C . Therefore, it should be considered as language ingredients existing in Object Pascal. (2) (6) Propose an efficiency problem, it can be seen that the "re-" cultural "is not understood by STL, and the solution is similar to the native type efficiency, and the C language" is not understood. " , The design concept of the rest of the class library. Naturally, there will be friends asking, will there be such a complex design through such a concept of C ? Well, it is because of the two higher priority concepts for "compatibility with C" and "combination of object-oriented and efficiency".
(7) Multiple inheritance
"There is no doubt that Object Pascal does not support multiple inheritance; it can also see that Borland has increasing this feature (in fact, it is light and easy). Object Pascal achieves multiple inheritance through the interface (" "You really need Do you have multiple inheritance? I think most of the programmers have never used multiple inheritances (even the VCL is so powerful and flexible). "
The same is Effective C in with multiple inheritance impartial evaluation of: "Depending on who's doing the talking, multiple inheritance (MI) is either the product of divine inspiration or the manifest work of the devil Proponents hail it as essential to the natural modeling. Of Real-World Problems, WHILE, DIFFCIT TO IMPLEMENT, AND NO MORE Powerful Than Single Inheritance. (According to different statements from various people, multiple inheritance (MI) is not a sacred inspiration product, is the devil witchcraft Crystallization. Advocity cheers for its "natural world naturally moderate model", the critics pointed out that it is too slow, it is difficult to achieve, not more powerful than a single inheritance.) "(8 Object Template "Object Pascal does not support object template. Because the object template is just the language of the macro (the macro it is not the language characteristics of C / C )."
This is the only comment on the template mechanism. In my concept, C strong template mechanism will not only value this. C supports four programming modes: (1) Process program design (2) Based on object programming (similar to Ada) (3) Object-oriented programming (4) generic programming. The generic programming is implemented on the basis of the template mechanism and has been used in STL. Essentially, this is related to the language of language. A language that has a template mechanism, which can be expressed, naturally more language that does not provide this mechanism. In particular, when it is combined with the running polymorphism, it can express the language of purely object-oriented difficult to express. The so-called parameter class in the UML is the abstraction of the template class. Take a look at Java, the industry leading pure face object language. Although Bruce Eckel said in his famous "Think in Java" does not agree with a template mechanism, the next version of Java will also have a generic mechanism similar to template. In the way, "re-" text error: C template is divided into class template and function template, and there is no "object template".
(9) Overload
"Object Pascal supports the overload of the function / process, does not support operator overload. C all support. (PS: I personally prefer Object Pascal to add support for operator overload)"
(10) Bit and logical operations
"Object Pascal and C / C have no difference in this regard."
(11) style
"In fact, this is an important reason I prefer to use Delphi (I often use C and compilation because of some articles:" Object Pascal and C are the same heavyweight language ", It is really difficult to divide Xuan, the difference is mainly in style. C emphasizes flexible, and Object Pascal is more implicit and beautiful. "
"Object Pascal and C are the same heavyweight language"? This is really spreading a wide range of misunderstandings. Since the emergence of C , it has been widely supported by the industry. After becoming a double standard of ANSI / ISO, it is more supported by various hardware and software platforms. It is undeniable that the Pascal language is also widely used, which has become mainstream development languages on Macintosh. But note that it is Pascal, not Object Pascal. The latter is only supported on a limited platform, which is not to say that C is on a heavyweight. After 966, I read the Java and C characteristics comparison. There is a sentence of sentences: "Trying to work with C , such as using the electric saw to remove the shell, powerful but not safe." Well, yes, use C must have Higher discipline, this is the price of the design philosophy of C "to the programmer". Language learning, I always look forward to the stage of three continuum: (1) Learning of syntax language. How to use syntax? How does the specified language express? (2) Learning internally. How does the compiler implement? How to express inside the specified language ingredient? (3) Experience in design concept. When you step into this phase, you should find that every language has its own design concept. Why is C multiple inheritance more delphi? Why is the Java embedded garbage collector, while C is provided as a third-party class library? From the consideration and balance of language philosophy, you should give an answer.
3. Features and other front comparisons are two basic elements of language: language itself and compiler. Twenty years ago this is everything, the programmer is unfold from the head, stacked its own code on the poor function library. But the introduction of Framework brings a revolution. "I am far from others, just because I stand on the shoulder of the giant", Newton's sentence is in order to describe the status of Framework in the development. The other protagonist of the revolution is the so-called IDE (integrated development environment). The older programmer let the finger jump on the keyboard, so that the screen has dazzled rollover switches, um, "Dance of the Finger on the keyboard." However, this is the era of the mouse dance, the battle of development tools, the focus has been bonded to Framework and IDE from the language and compiler. Oh, don't mention Java with me, it will compete with C #, focus on the Framework behind it.
(1) Obtainability
"There is no doubt that Delphi has a huge advantage, this doesn't have to say more."
(2) Scope of application
"VC can almost any hardware allowed. Delphi can also."
From the perspective of developers, Delphi is extremely easy to use mainly from two aspects: (1) RAD development method. Rad is the most intuitive development, "Dance of the Mouse" I didn't know how many programmers' development capabilities were released. But there is no lunch in the world, the code is broken, and the incremental development is easy to granularize the particle size and other effects. It is completely using the RAD development large system is always a challenge for software engineering capabilities. (2) High level package. As we all know, the package level of the VCL is high, so that the programmer does not need to contact the underlying detail through VCL, and thus improves ease of use. This does not mean that Delphi has lost its ability to operate the underlying operation: Design a reasonable Framework always provides a method of breakdown agency layer. But the breakdown agent layer is not normal, efficiency and convenience, often not within the designer. (3) Integrated development environment
(4) Database support
(5) Network function
(6) Component support
"Delphi also supports COM / DCOM-based components (such as ActiveX), in addition to Object Pascal-based VCL / CLX, and CORBA support. VC only supports support Based on COM / DCOM." When VC develops CORBA programs, you must use The third party provides the development library.
(7) Application framework / design ideas
"VCL is at least one generation than MFC, which is not much."
VCL is ahead of MFC, which is an unquestionable fact. For the evaluation of Framework, in addition to the package of the underlying API, it is more important to the message mechanism. The message is delivered between the object, is a core of Framework, which has a decisive impact on the object model of the entire framework. The VCL is better than the MFC, and the substance is the "responsibility chain mechanism" superior to the "message mapping mechanism" implemented by the MFC macro. As for the encapsulation of the underlying API, you are happy, but also to achieve one by self-satisfaction. (8) Debugging (9) Running Environment / System Demand
(10) Product quality / stability
"There is article" VC quality, high stability ". Is this really? Visual Studio's service pack is not 4? What is a service pack? Is it mainly bug fix patch ?!" "Really, the quality is not good, the operation is stable and unstable, mainly on the development of the level / responsibility."
Carl. Pop is proposed in his scientific philosophy: proposition can only be certified and cannot be confirmed. Extended software engineering, software can only be proven to have bugs, and it cannot be proved that there is no BUG. In fact, such software is inevitable with a large number of hidden mistakes. Continuous Service Pack is indicating that the test starting is uninterrupted, and more responsibility is more responsible than the ignorant ostrich policy. Throwing the quality of the class library and tool itself does not talk, the choice of language, and the software quality also affects. In the language of "stable supreme" concept, it is widely provided with a strong fault tolerance mechanism, and the design of the language itself has also prevented programmers from making mistakes. In the Java cancelled pointer, it is impavity to "stabilize the supreme" concept.
(11) Help / document
(12) International Support
(13) Application field "VC drive development in Windows equipment (after all, M $ Windows) and some desktop applications (such as games) are used more .Delphi more applied in database / multi-layer structure, multimedia and Internet development The aspects. "Actually, users who use VC are the field of communication. In my individual, it is often located in the development of Universal Software. It is necessary to try to do less; and Delphi is used for the development of customer custom software (pure personal view).
(14) price
(15) Down compatibility
This is the issue of "re-" text to avoid talking. In fact, Delphi is not good here.
(16) prospect
"Don't have a few years, two all have disappeared." Of course, this is just the excitement of the author.
First look at Borland's market strategy. In fact, Delphi is in a sashimi in the market. No, and very highly said low VB and high-end VCs, but strong Java and freshman C #. Just, both support the RAD development method, have a strong network characteristics, optimized database support, where is Delphi tolerance? Borland answered with Kylix: "Provides cross-platform transplantability that can play platform characteristics." Java provides a platform-independent, C # is more capable of playing platform characteristics;, Java cannot play the platform characteristics, and C # has no cross-platform portability. The market space between the two is enough to Delphi.
What will VC going?不避 免, VC 's role will be offset to the background, get out of the front desktop -> Background Service -> underlying support -> system development. This is to pay attention to the efficiency C fate. 4. Conclusion "Delphi (in fact, Borland products) has a technical advantage in technology, and VC (in fact, M $ product should be said) also has considerable market share."
This is a conclusion that there is no conclusion. Well, all the answers are not written in the analysis and description of the previous article?
The attachment of "re-" text is not analyzed. After all, it is just the cheap purifier of emotions.
I don't say that I am VC user, there is special feelings for C . But I hope that the story of "re-" text has not been overkill; I hope that the article you read later can face the fact that there is no longer "six bets me".
PS: Talk again Delphi VS VC http://www.9cbs.net/develop/read_article.asp?id=5264 touch me: Dream_soft@263.net