GURU Of THE WEEK Terms 13: Object-Oriented Program Design

zhaozj2021-02-08  514

Gotw # 13 OOP

Author: Herb Sutter

Translation: Kingofark

[Declaration]: This article takes the Guru of The Week column on www.gotw.ca website, and its copyright belongs to the original person. Translator Kingofark translated this article without the consent of the original person. This translation is only for self-study and reference, please read this article, do not reprint, spread this translation; people download this translation content, please delete its backup immediately after reading. Translator Kingofark is not responsible for people who violate the above two principles. This declaration.

Revision 1.0

GURU Of THE WEEK Terms 13: Object-Oriented Program Design

Difficulty: 4/10

(C is an object-oriented language? Different from the popular views, this Terms believe that it is not.)

[problem]

"C is a powerful language, providing many advanced object-oriented technology construction, including packaging, abnormal processing, inheritance, template, polymorphism, strong type mechanism, and perfect module system."

Please discuss this proposition.

[answer]

The purpose of this Territor is to trigger a discussion of C major (or even missing) features to provide a nutrients of C true nature. In fact, I also hope that the final result of the discussion can express three points - I didn't disappoint:

1. Not everyone has a consistent view of "what is object-oriented". Most people should agree that inheritance and polymorphism are object-oriented concepts; some people will also count the package; may only have a few people think that abnormal processing is also object-oriented concept; maybe no one will put the template Calculate it. So far, people still have different views on this issue.

2. C is a language that supports multiple programming patterns, not just object-oriented languages. C supports many object-oriented features, but does not force programmers to use these features. You can use C to write a non-directional program - actually doing this.

3. No language is universal. Today, I use C as my main programming language; I will choose any language that I will do what I want to do tomorrow. C has no module system (and does not say it is not perfect), it also lacks characteristics such as garbage collection; C has static type mechanism, but there is no necessary "strong" "Strong type. All languages ​​have their own advantages. You should choose the language that is best suited to solve the current problem, resist temptation, avoiding the generous language fan J

(Finish)

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

New Post(0)