ForC ++The design objectives and principles are described in detail.
I. C ++ Design objective C ++ Design Aims)
The objective of C ++ is to make C ++ adaptive and efficient as a C language suitable for system programming, in terms of its program organizational structure, it can also have the program organizational structure supported by Simula, a language facility like Simula, which is often referred to as an object-oriented programming style ). During the design, great efforts were made to make it possible to apply the high-level programming technology introduced from Simula to system programming. That is to say, the abstract mechanism provided by C ++ can be applied to programming tasks with high requirements on efficiency and adaptability.
The above C ++ design goals can be summarized as follows:
For programmers who want to solve practical problems, C ++ makes programming more fun. C ++ is a general purpose programming language, which:
Is a better C;
Supports data abstraction;
Supports object-oriented programming;
Supports model programming.
The support for model programming is implemented as a clear and independent goal only after the C ++ design stage. For most of the time in the C ++ evolution process, I have always put the norm programming and language features that support it under the title of "data abstraction.
Ii. Design Principles of C ++)
In [Stroustrup, 1994], C ++ design rules are divided into four aspects: basic rules, design-based rules, language-based technical rules, and rules based on low-level program design, in the following section.
1. General rules)
Each step of evolution and development of A and C ++ must be caused by actual problems;
B. C ++ is a language rather than a complete system;
C. Do not pursue perfection endlessly;
D. C ++ must be useful in the period in which it existed;
E. Each language must have a well-established and clear implementation scheme;
F. A work und is always provided;
G. provides easy-to-understand support methods for each programming style to be supported;
H. Do not force the user.
It can be noted that the last three elements of the basic rule imply two points: the emphasis on convenient tools for various applications in the real world and the technical and orientation preferences of programmers. From the very beginning, C ++ is intended for programmers who want to build real projects. The so-called "perfection" is considered impossible because the requirements, background, and issues to be resolved of C ++ users are too different. Moreover, even the interpretation of the word "perfect" may be greatly changed throughout the lifetime of a general-purpose programming language. It can be seen that in the process of language evolution, user feedback and experience accumulated by language practitioners are the most important.
2. Design-support rules based on Design rules)
A. Well-designed solutions are supported;
B. Provide language facilities for program organizations;
C. Say what you mean );
D. All language features must be able to bear effectively;
E. Enabling a useful feature is more important than avoiding all misuse;
F. Combine independently developed components into complete software.
One of the goals of C ++ is to provide more easy-to-use and affordable design ideas and program design technologies to further improve the quality of the program. Most of these technologies are sourced from Simula and are generally discussed as Object-Oriented Programming and object-oriented design ideas. However, the goal of C ++ is to support various programming styles and ideas within a certain range. This is a comparison with general views on language design. Generally, in terms of language design, it is always an attempt to build all the systems in a separately highlighted, mandatory programming style or a model paradigm ).
3. Language technical rules Language-technical rules)
A. There is no internal conflict with Static type system;
B. the built-in built-in type provides good support for user-defined types;
C. alienated locality) behavior is desirable;
D. Avoid sequential dependencies;
E. When you have doubts about the language, you can select the easiest part of its features;
F. Syntax matters often in perverse ways can be caused by improper Syntax usage ))
G. weaken the use of the Preprocessor.
Of course, these rules should be specifically combined