//From <Delphi 5 Developer's Guide>
1.2 What is Delphi?
We often ask questions like: "What makes Delphi so good?" and "Why do I prefer Delphi to other programming tools?" and so on. Over the years, we've come up with two answers, one long and one short, to questions like these. The short answer is: efficiency. To create Windows applications, using Delphi is the easiest way we can find. Of course, some people (bosses and future customers) are not satisfied with this answer. Therefore, we must present our detailed answer, which illustrates the combination of factors that make Delphi so effective. We summarize the factors that determine the efficiency of a software development tool into the following five points:
• Performance of the visual development environment.
• The speed of the compiler and the efficiency of the compiled code.
• The capabilities of programming languages and their complexity.
• Flexibility and scalability of database structure.
• Framework extensions to design and usage patterns.
Although there are many other factors that should be included, such as configuration, documentation, third-party support, etc., we have found that this is the most accurate and simplest way to explain to people why we chose Delphi. Of course, the above five points may also include some subjective factors, but the key is: how efficient can you be when using a specific tool for development? As shown in Figure 1-1, the performance of various aspects of a tool is evaluated and quantified (between 1 and 5) and marked on each axis of Figure 1-1. Finally, a pentagon can be obtained. The larger the area of the pentagon, the more efficient this tool is.
No need to tell you what answers we got using this method - you'll find out for yourself once you try it! Let's take a closer look at Delphi's performance in these areas and compare them with other Windows development tools.
1.2.1 Visual development environment
A visual development environment is usually divided into three components: editor, debugger, and form designer. Like most modern RAD (rapid application development) tools, these three parts work together. As you work in the form designer, Delphi automatically generates code behind the scenes for the controls you are manipulating on the form. You can also add code yourself in the editor to define the behavior of the application, and you can also debug the program by setting breakpoints and monitoring points in the same editor.
In general, Delphi's editor is similar to the editors of other tools, but its Code Insight technology saves a lot of input work. This technology is based on compiler information, rather than on type libraries like Visual Basic, so it has a wider range of applications. Although Delphi's editor also has many good configuration options, I think Visual Studio's editor has more room for configuration. In version 5, Delphi's debugger function has finally caught up with Visual Studio's debugger, with many advanced features, such as remote debugging, process association, DLL and package debugging, automatic local monitoring, and CPU windows. Delphi also supports randomly placing and docking windows while debugging and saving this state as a command's desktop setting. As a result, Delphi's IDE has achieved good support for debugging functions.
As often seen in some integrated environments (such as VB and some Java tools), the advantage of a very complete debugger is that when the application is debugged, it can modify its code, thereby changing its behavior . Unfortunately, this functionality is not supported by Delphi because it is too complex to implement when compiled into native code.
For RAD tools (such as Delphi, Visual Basic, C++Builder and PowerBilder, etc.), the form designer is a unique feature. Some of the more classic development environments, such as VC++ and BC++, provide conversational editors, but do not integrate the form designer into the development process. As can be seen from the efficiency chart in Figure 1-1, the absence of a form designer will reduce the overall efficiency of the development tool. Over the past few years, Delphi and Visual Basic have been competing fiercely to improve the functionality of the form designer. Each of their new versions has better features than the last. What makes Delphi's form designer unique is that Delphi is built on a true object-oriented framework. This way, changes you make to the base class will be propagated to all derived classes. One of the key technologies involved here is VFI (visual form inheritance), which is visual form inheritance. VFI technology enables you to dynamically inherit from any other form in the current project or object library. Whenever the base form changes, the derived form is immediately updated. This important feature is explained in detail in Chapter 4, "Application Framework and Design."
1.2.2 Compiler speed and compiled code efficiency
A fast compiler allows you to develop software step by step, frequently modifying the source code, recompiling, testing, modifying again, compiling again, testing again... forming such a good development cycle. If the compilation speed is very slow, developers will have to modify the code in batches, making multiple changes before each compilation to adapt to an inefficient loop process. It improves running efficiency, saves running time, and generates shorter binary codes. Its superiority is self-evident.
Perhaps the most famous feature of the Pascal compiler is its speed, and Delphi is built on this compiler. In fact, it may be the fastest high-level language native code compiler for Windows. C++ compilers that used to be slow have made great progress in recent years, adding linking and various caching strategies, especially in Visual C++ and C++Builder. But even so, the C++ compiler is still several times slower than Delphi's.
Is compilation speed necessarily proportional to running efficiency? Of course not. Delphi and C++Builder share the same compiler backend, so the generated code is equivalent to that produced by a good C++ compiler. According to the latest reliable evaluation standards, Visual C++ is considered on many occasions to be the most efficient in terms of compilation speed and generated code length, thanks to some extremely powerful optimization measures. While these small advantages are hard to notice for typical application development, they can come into play if you're writing complex computational code.
Visual Basic's compilation technology is a bit special. During development, VB operates in an integrated manner and is quite responsive. This compiler is slower and the executable code generated is far less efficient than Delphi and C++ tools.
Java is another interesting language. The latest Java-based tool languages JB uilder and Visual J++ claim that their compilation speed can match
It is comparable to Delphi, but the execution efficiency of the generated code is not satisfactory because Java is an integrated language. Although Jave is making steady progress, its running speed is still far behind Delphi and C++ in most situations.
1.2.3 Functionality and Complexity of Programming Languages
The functionality and complexity of a language are in the eye of the beholder and are the subject of much debate. What is simple for one person may be difficult for that person; what may be of limited functionality to one person may be perfect for another. Therefore, the following points are only based on the author’s personal experience and understanding.
Assembly is fundamentally the most powerful language. You can do almost anything with it. However, even developing the simplest application in assembly is very difficult and may result in nothing. Not only that, but keeping a piece of assembly code in a group development environment for any length of time is sometimes simply impossible. As the code is passed from one person to the next, and the next person, the design ideas and intentions become increasingly unclear, until the code looks like a book from heaven. As a result, we rate assembly very low, as it is powerful but too complex for almost all developers.
C++ is another extremely powerful language. With the help of its potential features (such as preprocessor macros, templates, operator loading, etc.), you can almost design your own language using C++. As long as you use its rich functional options properly, you can develop concise, intuitive and easy-to-maintain code. The problem, however, is that many developers abuse these features, which can easily lead to major errors. In fact, it's easier to write bad C++ code than to write good C++ code. Because the language itself won't move in the direction of good design - that's up to the developers.
Object Pascal and Java feel very similar to us because they have a good grasp of the balance of complexity and functionality. They all take the approach of limiting their available functionality to enhance the developer's logical design. For example, both avoid the fully object-oriented but easily abused concept of multiple inheritance and instead implement a single class that performs the functionality of multiple interfaces. Neither supports beautiful but dangerous operator loading. Both have some powerful features, such as exception handling, run-time type information (RT TI) and self-managed string lifetime memory. At the same time, neither language is written by a dedicated editorial board, but comes from individuals or groups within a single organization who share a common understanding of the language.
Visual Basic was originally designed to make it easier for beginners to get started and progress faster (hence the name). But as a language, VB has to constantly learn from its strengths and weaknesses, which makes it become more and more complex in recent years. In order to hide these details from developers, VB still retains some wizards for creating complex projects.
1.2.4 Flexibility and scalability of database structure
Because Borland lacks a database scheme, Delphi retains what we consider to be the most flexible database structure of all tools. BDE is very powerful for most applications based on local, client/server and ODBC database platforms. If you're not happy with this, you can avoid using BDE in favor of the new native ADO components. If you do not have ADO installed, you can create your own data access classes or purchase a third-party data access solution. In addition, MIDAS makes multi-tiered access to data sources easier to implement. Microsoft's tools (ODBC, OLE DB or others) logically tend to support Microsoft's own database and data access solutions.
1.2.5 Framework extensions to design and usage patterns
This is an important feature that is often overlooked by other software design tools. VCL is the most important component of Delphi. The ability to manipulate components at design time, create components, and use OO (object-oriented) technology to inherit the behavior of other components are key factors that determine Delphi's efficiency. In many cases, VCL components are written using a fixed OO design approach. In comparison, other component-based frameworks are often too rigid or complex. For example, Active X controls have the same design-time capabilities as VCL controls, but cannot be inherited to create a new class with different behaviors. Traditional class frameworks, such as OWL and MFC, require you to have a lot of knowledge of the internal structure, and without design-time support from RAD tools, their functionality will be inhibited. A tool that can rival the functionality of VCL in the future is Visual J++'s WFC (Windows Foundation Classes), which is the Windows Foundation Class. But with Sun Microsystems' lawsuit over Java issues still pending, the future of Visual J++ is unclear.