1. Introduction
We often ask the question ": What makes Delphi so good?" And "Why do I prefer Delphi compared to other programming tools?" Wait a minute. In short, it's high efficiency. The factors that determine the efficiency of a software development tool boil down to the following five points: the performance of the ① visual development environment. ② the speed of the compiler and the efficiency of the compiled code. The functionality and complexity of the ③ programming language. ④ the flexibility and scalability of the database structure. ⑤ framework for the expansion of design and usage patterns.
Features of 2.Del Phi
2.1 Visual integrated development environment
A visual development environment is typically divided into three components: the editor, the debugger, and the form designer. Like most modern RAD (rapid application development) tools, these three parts work together. When you are working in the Form designer, Delphi automatically generates code for the controls you are manipulating in the form in the background. You can also add code to define the behavior of your application in the editor, and you can also debug the program in the same editor by setting breakpoints and monitoring points.
In version 5, Delphi debugger has many advanced functions, such as remote debugging, process Association, DL fracture debugging, automatic local monitoring and CPU windows. Delphi also supports the arbitrary placement and docking of Windows when debugging and saves this state as a command's desktop settings. Thus, the Delphi IDE realizes the good support of debugging function. The form Designer is a unique feature for RAD tools such as Delphi, Visual Basic, C++builder, and PowerBuilder. Some of the more classic development environments, such as VC + + and bc++, provide a dialog editor, but without integrating the form designer into the development process, no form designer will reduce the overall efficiency of the development tools. Over the past few years, Delphi and Visual Basic have been fiercely competitive in perfecting the functionality of the form designer. The uniqueness of the Delphi Form Designer is that Delphi is built on a truly object-oriented framework. In this way, the changes you make to the base class will be passed to all derived classes. One of the key techniques involved here is VFI (visual form Inheritance), the visual forms inheritance. VFI technology enables you to dynamically inherit any other form in the current project or object library. Once the base form has changed, the derived form is updated immediately.
2.2 Compiler speed and the efficiency of compiled code
Pascal compiler is the most famous feature is fast, and Delphi is based on this compiler. In fact, it may be the fastest high-level language native code compiler for Windows. The slow-moving C + + compilers have made great strides in recent years, adding links and various caching strategies, especially in visua1c++ and C++builder. But even so, the C + + compiler is still a few times slower than Delphi. Delphi and C++builder share the same compiler backend, which is a company product, so the generated code is equivalent to the code generated by a good C + + compiler.
2.3 The function and complexity of programming languages
C + + is a non-strongly typed language and some error compilers cannot find it. Object Pascal is very similar to Java, and they hold the balance of complexity and functionality well. They all take the approach of limiting the functionality available to enhance the logical design of the developer. For example, both avoid the idea of multiple inheritance that is completely object-oriented but easily abused, and instead implement a class that performs multiple interface functions. Both do not support the beautiful but dangerous operation Fugazai. Both have powerful features such as exception handling, Run-time type information (RTT), and lifetime memory self management strings. Especially the Run-time type information (RTTI), it is very important for us to design the Operation station and the field station in the simulation training system, with which we can automatically create the components and automatically recognize the components according to the data of the configuration database and assign the corresponding data. At the same time, Delphi is using the programming language is Object Pascal, is facing objects, strongly typed language. Facilitate the preparation of robust applications, reduce debugging, check the wrong time to improve development efficiency; A good description of real-world things and systems, such as control systems, process mathematical models.
2.4 Flexibility and scalability of the database structure
Because Borland lacks a database plan, Delphi retains what we consider to be the most flexible database structure in all the tools. BDE is powerful for most applications based on local, client-server, and ODBC database platforms. If you are not satisfied with this, you can avoid using BDE to support the new local ADO component. If you do not install ADO, you can create a data access class yourself or purchase a Third-party data access solution. In addition, Midas makes multi-tier access to data sources easier to implement. Microsoft's Tools (ODBC, OLE DB, or others) logically tend to support Mi-crosoft's own database and data access solutions.
2.5 expansion of the framework to design and usage patterns
This is an important feature that is often overlooked by other software design tools. VCL is the most important part of Delphi. The ability to manipulate components at design time, create components, and inherit the behavior of other components using object-oriented technology is a key factor in determining Delphi efficiency. In many cases, a fixed 00 design method is used to write VCL components. In contrast, other component-based frameworks are often too rigid or too complex. For example, an ActiveX control has the same design-time performance as a VCL control, but cannot be inherited to create a new class with other different behaviors. Traditional class frameworks, such as Owl and MFC, require a lot of internal architectural knowledge, and their functionality will be suppressed without design-time support for RAD tools.
Event-driven mechanism for 3.Del PHI
3.1 Non-agreed programming
Compared with the traditional Windows Messaging mechanism, the biggest advantage of Delphi's event-handling mechanism is that all events are not agreed. For programmers, no convention means that nothing can be done in an event handler. In the traditional Windows Messaging mechanism, you have to call the base class's message handlers and pass the information back to Windows. Of course, the Delphi event handling mechanism of the no agreed programming method may not be directly flexible and efficient message processing, you have to be subject to who raised the event and the application of the event to respond to the response. For example, you can modify and cancel keystrokes in the onkeypress handler, but the OnResize event handler can only provide notification that the event has occurred without further preventing or controlling the size change.
However, Delphi still allows you to handle Windows messages directly in an event handler. It's just not as simple as an event-handling mechanism, because message processing requires programmers to have a detailed understanding of the message to be processed. You can process all Windows messages by using the keyword message. The advantage of using Delphi to develop an application is that you can either program in an advanced, Easy-to-understand way, or access low-level information directly when you need it.
The VCL message system of 3.2 Delphi
All Delphi classes have a built-in mechanism for handling messages, called message processing methods or messages handlers. The basic idea of message handlers is that classes get some kind of messages and then redistribute (dis-patch) them, handled by the response's handler function or procedure (which handler function or procedure is invoked depending on the accepted message). For a particular message, if no specified method exists, it is handled by a default message.
VCL defines a message distribution system that passes all Windows messages, including user-defined messages, to the appropriate objects and is processed by the message distribution system for each object. The method used by the VCL object to receive messages is called Mainwndproc (). With Mainwndproc (), you can perform any special processing of the message. In general, however, Mainwndproc () is rarely called directly to process messages unless the message is not distributed through the VCL message system. When returned from Mainwndproc (), the message is passed to the object's WndProc () method, which is the form process of the object, and then goes to the distribution mechanism of the VCL. The distribution organization uses the dispatch () method to distribute messages to a message handle. After the message arrives at the processing handle of the message (Handler), the message processing is finished by processing the handle. There is no need to change the message distribution mechanism, all you have to do is to produce a message processing method or handle, a message handler function.
3.3 Accelerated Prototyping
After the use of Delphi for some time, even if you are just a novice, you will find that the first project with Delphi can benefit immediately: short development cycle, application robustness. Designing the user interface (UI) is a headache for many Windows programmers, and that is exactly what Delphi does. The design of the user interface and the layout of the program are called prototypes. In a non-visual development environment, applications are often prototyped longer than the actual implementation of the program. A simple, intuitive, pleasing user interface is a large part of the application.
Delphi can quickly build the user interface you need with its custom controls or its own developed controls. When you can skillfully use Windows, controls, and event response methods, you will find that the prototyping work that used to take a lot of effort is now greatly simplified. At the same time, the user interface developed with Delphi is not inferior to the user interface built with traditional development tools. In Delphi, what you see in the design period is often the final product.
4. Concluding remarks
To sum up, you can find that Delphi 5 itself is a very powerful object-oriented development platform, its Visual component library VCL (Visualcomponent library) is an easy to learn, easy to use, efficient reusable software objects, but also contains a wealth of database applications, Communication components. Delphi itself is written by using VCL, not only the interface development is convenient and rapid, but also for the system with components and the use of the assembly as a configuration. Simply place the component in the form, move the mouse to the location you want, and change certain attributes to suit your requirements.