"Delphi master breakthrough" first chapter - preview version

zhaozj2021-02-08  225

Written in front: Currently, a book that is a Delphi skilled programmer is being written, the theme is to build a well-designed program for object-oriented programming technology in Delphi. This book is still in writing, I hope that everyone can have a pre-understanding of the subject of this book and language style. At the same time, you can make your own opinions. As the author, I hope this book can be the classic of the original Delphi book in China, but I don't have to succeed, but I tried my best. Due to the above reasons, I can't post all books (huh, there will be no one to buy), so there should be no subsequent chapters (maybe there will be some excerpts). Here, I would like to thank those friends who encourage me (in the 9CBS Delphi Forum, got a wide range of responses, thank you). Thank you for your support, motivate my girlfriend. What I can do is to write a book, return everyone, I know that everyone is too hard!

Chapter 1 re-recognizes Delphi

Simpality is the most difficult thing in the world: it is the final boundaries of experience, and it is also the final effort of genius. --Gerge Sand

You are already a skilled Delphi programmer, you can quickly write a beautiful, practical program using Delphi; you love Delphi; she has become a job in your work and indispensable part. I assume that these are true, then you have chosen Delphi as your preferred development tool, you must have your own reasons or causes.

At least, I am in line with all the assumptions. Now, I want to share with you, it is the reason and reasons for I choose Delphi, and my understanding of Delphi. You can think of me as a fanatic fever that supports Delphi. Although it will make me feel that you look too superficial, I don't admit it, but I don't mind. Because, I really love her.

The first time you have contacted Delphi is 3.0, it is only used as a RAD tool as Visual Basic. However, over time, Delphi 3, Delphi 4, Delphi 5, Delphi 6, and Kylix, the understanding of Delphi is getting deeper. It is a tool with rich connotation, the more understanding her, the more embarrassed her, the more I feel that she is almost the tool.

Pascal is a language of the procedure - there is no doubt that the Pascal code is the best code - Delphi based on Object Pascal (an object-oriented Pascal language) makes this beauty to the extreme.

Now, you can open Delphi, select "Help" - "About" menu, after the About window, press and hold the Alt key, simultaneously type "Team", what did you see? Yes, the list of Delphi developers, let us thank them for making such a development tool for artwork!

1.1 Development Tool "People-oriented"

It can often be seen in various programming forums similar to this: "Is VB still have a future?"; "Delphi is eliminated?"; "Is MFC to be replaced by .NET?" ... In fact, these The problem is that no one can give an answer at the time. Because of a technology, a product is in the future, it is related to its own factors, and the development direction of market demand, production company. And what we should pay attention to, is it the answer to these issues? I think not. We know that everything is consisting of atoms; the thousands of variable procedures are constructed by the three structures of the order, cycle, and branches; whether the VC's MFC, or the VCL of Delphi, is built by object-oriented technology (mainly regardless of its objective) ). When you dial the surface of the things, you see, is the same or approximate in nature! After mastering the essence, it will find that the expression of the appearance is that a matter of course. Imagine, when you can look like Houjie ("deep-in-depth MFC" author), you will worry about MFC being replaced by a certain framework? From this perspective, for a professional programmer, the idea of ​​programming is that it does not leave its part. Discover problems, analyze problems, and solve problems have some model. When you master this mode, different programming languages, different development environments have a common place.

I think C is to master each professional programmer. Of course, it is not to say simple learning its grammar (and even some grammar learning), but through C learning, object-oriented design, programming methods. Because C is profound, because C is omnipotent. In C , you can learn all the object-oriented theory, you will be transformed by C . Because in the object-oriented theory, there is a controversial feature (such as multiple inheritance) to be supported in C . You can only make your choice (support or opposition) after you master. After mastering the object-oriented theory, regardless of C , Object Pascal or Java or even C #, you will feel the same intentions.

Is it that development tools (perhaps, it should be called integrated development environment, but it is still in addition to supporting the language in addition to my habits. Of course not. Development tools are tools to help you implement your philosophy, which is the upper building built on the basics. Development tools for the level of support you want to achieve and the simplification of the implementation process are the consideration of development tools. Developing tools in programmers, like weapons in soldiers, weapons are not in turn, and have not yet lost.

I have always liked advertising words for Nokia mobile phone: technology people-oriented! Yes, "people" is this, the mission of tools is faster and more easily for assistants. Therefore, development tools should also be people-oriented!

As a programmer, as the most direct user of development tools, I hope that the development tools I use is really my partner, assistant, it can give me freedom, let me freely in the world of code In the middle, it can move me, adapt to me, not the opposite, give me a shackle!

Now in the Windows platform, there are many development tools to choose from: Visual C , Visual Basic, Delphi, C Builder, JBuilder ..., based on different programming languages, loyal to different companies' product philosophy, from this perspective The difference between them is very large. What kind of development tool is excellent, thoughtful, people-oriented? My standard is in line with the following four points:

1. Simplify the problem to be solved, and quickly implement it with some idea

2, do not hide any details you want to know

3, you can ignore the details you don't want to know

4, take the initiative to adapt to the programmer of different levels

Does the development tools that meet the above four points? My answer is: Yes! That is Delphi! She will make everything, but never stop me from seeking truth. You can complete the task in the simplified VCL of you. You can also drill into the world of VCLs to try the map relationship of her and real-world interfaces of the Windows platform, learn its Framework design. You can also extend the virtual VCL world to adapt to your needs.

I am lucky for the existence of such a development tool, and even more fortunately, I can choose her, and complete my work with her! (In reality, what programming language is used in the project, development tools, often not your personal can be around, which will be restricted by many factors. For example: the customer's hardware environment, operating system environment, development environment, cost of development tools, license Certificate, etc., so you can choose the development of your favorite development tools.)

Through C learning the object-oriented concept, use delphi to solve the problem of the real world, this is my approach. At the same time, the sentence is also verified: learning from difficulty in learning, using it.

Real programmers use C , smart programmers with Delphi. So, the truly smart programmer uses C to understand Delphi!

1.2 Delphi more advantages

Have a lot of mainstream development tools, why did you choose Delphi? Perhaps because I don't have to be familiar with other development tools, Delphi itself is at least one of the reasons! Where is Delphi excellent?

Efficient

Delphi is a RAD (Rapid Application Developments), which has a visual development environment, of course, developed a similar function (such as Visual Basic), but Delphi has the following uniqueness:

1) Delphi is a true face-to-objective object. All components in the VCL library built based on OO technology can be inherited to create new components, including formats TFORM. In contrast, ActiveX components lack this flexibility.

2) Delphi's codeInsight technology (ie, the code automatic completion function) is built on the compiler information, and VB uses type library information, the benefits of using compiler information are more flexible. However, there are often programmers complaining that the code tips of Delphi are too long. In fact, I personally feel that after it is used to it, I can understand the pleasure of a rhythm.

Efficient of n language

Delphi is based on Object Pascal language. This is a language that truly supports object-oriented and elegant and beautiful. Its function is not inferior to a variety of other other object-oriented languages, but at the same time, it is not greedy, blindly increases complexity. Make developers can be improved when designing various modes, but does not need to consider too many languages ​​/ compilers details. N-compiled efficient

It can be said that Delphi is the fastest high-level language local code compiler on the Windows platform. What is the benefit of compilation speed? A quick compiler allows you to switch between modifying code and compile operation. At least, I am very used to this way of working: Run the program to see the effect, exit the program to modify a small number of code and run the program. And Delphi's compiler never makes me feel awaiting.

N-executed efficient

Delphi is not only compiled quickly, but also the performance efficiency of the generated target code is also very high. Delphi and C Builder use the same backend optimizer, so the efficiency of its generated code is the same as the code generated by the excellent C compiler.

Delphi generates a complete local code, so the executable of Delphi compile results can be executed independently, distribute (for "green software" development, this is important). No other run library support is required. Of course, you can also choose dynamic link compilation, which can greatly reduce the length of the executable file, but in this case, the necessary runtime file must be distributed at the time of the distribution program.

N maintenance efficient

C gives many decision-making rights to programmers, so the features are very powerful, but at the same time, use C to write outstanding object-oriented code, requiring programmers to have certain qualities. The Delphi programmer is limited to the framework provided by the VCL (of course, it can be easily established in Delphi), relatively, easier to establish a well-designed code. Visual Basic does not provide an object-oriented programming mechanism (VB6.0 and previous versions are objects, rather than domain). The excellent code framework makes software maintenance costs greatly reduced.

Based on all the above reasons, I choose Delphi!

1.3 book theme

We will write a lot of code for the company, for yourself or for your friends. Sometimes, in order to verify your own ideas, or learn a certain technology, you will write some experimental code. The life cycle of such a code is very short, and it is basically no maintenance, and it can be written freely. However, when you really want to complete a project, the code design is very important. Because such code is a long-term maintenance, constantly modify or enhance. Design messy code will make maintenance is very difficult or impossible, modifying such a code means that more bugs are generated or disaster.

Therefore, the code needs to be designed before being written. The design referred to herein is not a functional design, but the programmer is designed to the code frame before encoding so that future code is more prone to understand, maintained.

I often hear a statement: the programmer's program life is only 35 years old. I never believe that the programmer's life is only 35 years old. Maybe after 35 years old, achieving the ability (in fact, the craftsmanship) has a decline, and the design capacity is not reduced with the increase of experience. This is the most precious.

Foreign software development groups, the general backbone is a person who is 40 years old. Those are the master's programmers, and the so-called 35 years old cannot be a programmer's programmer is not eligible for programmers.

The software engineering should turn the programmer into an encoder, become a ring on the pipeline, and the design work is done by a special designer (such as a frame designer). Perhaps, the division of labor is trend, but we are satisfied with the codec or hope to grow as designers, depending on our eyes and efforts. Let go of your eyes, not to limit your own, add yourself to "realize your master." The ability to achieve is the foundation, and there must be a certain ability to grow, but it is just a necessary condition, not sufficient. Otherwise, I think I have to go to the top of the mountain, I have stagnated. So, you can only be an encoder, your program life is only 35 years old. After having such an eye, I hope this book can help you start.

Domestic published Delphi related books is basically explained. The title of this book is "Delphi master breakthrough". So, suppose you are now Delphi master. Therefore, this book will not involve too many implementation skills, although there is also an example code, but the focus is the design of its architecture, but not realized.

At this point, you may have guess the subject of this book: How to use object-oriented technology in Delphi, build a good design code.

In my opinion, writing code is artistic creation. Elegant code can be interpreted without having to have too much comments. When the comment is too much, it is reasonable to consider the design. Writing should also be artistic creation. If you can tell your readers, you don't need too much "annotation" (nonsense), it is very successful. I hope that I can do it, at least try.

1.4 small knot

I believe that I am going to program the way, it is inevitable for me. It is also a professional programmer, but also what I have dreams. However, Delphi's appearance and part of the work I know, familiar, obsessed with work, should be said to be an unexpected surprise.

Here, what I want to say is that for my own persistence, I will stick to some. When you are awake, you will clearly know that you have chosen the way you choose, you don't have to ask questions, have a scruple, stick to it. Eventually, although it is not necessarily success (of course, everyone is different from the definition of success), but loves me, no regrets!

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

New Post(0)