📄 cppfatherletter.html
字号:
matters. If the concepts used in the better C subset are known the 100
pages will only take a couple of hours to learn and some details will
be interesting and useful. If not, the time spent is essential.<br>
</div>
<br style="font-weight: bold;">
<span style="font-weight: bold;">例如,一个有经验的C程式设计人员可能自认为熟悉C",因而误以为熟知C++中"较
好的C"子集,并跳过</span><span style="font-weight: bold;">书本中描述这部份</span><span
style="font-weight: bold;">的100或</span><span style="font-weight: bold;">更
多</span><span style="font-weight: bold;">页,然而,这么作之后,他可能忽略了函式重载的能力、配置时new
运算子的使用、参考的解说、或一些其它的小特性,以至于之后他还必须回想这些复杂东西在那边曾经出现过。如果已经知道较好C子集的观念,这100页只会花
上您几个小时来学习,且有些细节是有趣且有用的,如果不是的话,则所花费的时间就是必要的。 </span><br
style="font-weight: bold;">
<br>
<div style="text-align: justify;">Some people have expressed fear that
this ``gradual approach'' leads people to write in C style forever.
This is of course a possible outcome, but nowhere as likely as
proponents of ``pure'' languages and proponents of the use of ``force''
in teaching programming like to believe. The key thing to realize is
that using C++ well as a data abstraction and/or object-oriented
language requires the understanding of a few new concepts that have no
direct counterpart in languages such as C and Pascal.<br>
</div>
<br style="font-weight: bold;">
<span style="font-weight: bold;">有些人表示,他们怕这种"渐进方法"会导致人们都使用C的风格来写程式,这当然是有
可能的,但现在是"纯綷"程式语言的支持者,与教导程式使用的支持者的问题,关键点在于必须了解,要将C++好好发挥在资料抽象化与(或)物件导向程式语
言上,就必须要了解一些新的观念,而这些新观念与一些语言,在像C与Pascal之类的语言并没有直接的关联。 </span><br>
<br>
<div style="text-align: justify;">C++ isn't just a new syntax for
expressing the same old ideas - at least not for most programmers. This
implies a need for education, rather than mere training. New concepts
have to be learned and mastered through practice. Old and well-tried
habits of work have to be re-evaluated, and rather than dashing of
doing things ``the good old way'' new ways have to be considered - and
often doing things a new way will be harder and more time-consuming
than the old way - when tried for the first time.<br>
</div>
<br>
<span style="font-weight: bold;">C++不仅仅是表现一些老旧主意的新语法,至少对多数的程式设计人员来说不是,这需
要一些教育,而不只是训练。新观念必须要学习并透过练习来主导,在工作上旧有且良好的经验习惯必须要重新提升,而不是作一些"旧有良好方法"之延伸,新的
方法必须要考虑进去,而在第一次试着使用时,每次都用新的方法会困难的多,而且比使用旧方法花费更多的时间。 </span><br>
<br>
<div style="text-align: justify;">The overwhelming experience is that
taking the time and making the effort to learn the key data abstraction
and object-oriented techniques is worth while for almost all
programmers and yields benefits not just in the very long run but also
on a three to twelve month timescale. There are benefits in using C++
without making this effort, but most benefits requires the extra effort
to learn new concepts - I would wonder why anyone not willing to make
that effort would switch to C++.<br>
</div>
<br>
<span style="font-weight: bold;">绝大多数的经验是,花费时间与努力来学习关键的资料抽象化与物件导向技术,对大多数
的程式设计人员绝对是值得的,而产生的效益不仅仅是在最后,且持续三到十二个月的时间。在使用C++时是有一些不费力即可得到的好处,但大多数的益处是需
要额外的努力来学习新观念。我质疑的是,为什么有人不想附出这些心力就想转换至C++。 </span><br>
<br>
<div style="text-align: justify;">When approaching C++ for the first
time, or for the first time after some time, take the time to read a
good textbook or a few well chosen articles (the C++ Report and the C++
Journal contain many). Maybe also have a look at the definition or the
source code of some major library and consider the techniques and
concepts used. This is also a good idea for people who has used C++ for
some time. Many could do with a review of the concepts and techniques.
Much has happened to C++ and its associated programming and design
techniques since C++ first appeared. A quick comparison of the 1st and
the 2nd edition of ``The C++ Programming Language'' should convince
anyone of that.<br>
</div>
<br>
<span style="font-weight: bold;">第一次接触C++时,或者是在某个时间之后又再度接触C++,请花时间看一本好书,
或者是一些精选的文章(C++ Report与C++ Journal
Contain中有很多),也许看看一些主函式库的定义与原始码,并考虑所使用的观念与技术,这对于过去曾经使用过C++的人也是个不错的主意,这可以对
观念与技术作一个复习,在C++第一次出现之后,中间C++又发生了许多事,而相关的编程与设计技术也有了改变,比较一下"The C++
Programming Language"第1版与第2版的差别,任何人都会相信这点。 </span><br>
<br>
How long does it take to learn C++?<br>
<br style="font-weight: bold;">
<span style="font-weight: bold;">学习C++要花多久的时间? </span><br>
<br>
<div style="text-align: justify;">Again, that depends. It depends both
on your experience and on what you mean by ``learning C++.'' The syntax
and basics for writing C++ in the better C style plus defining and
using a few simple classes takes a week or two for a programmer. That's
the easy part. The main difficulty, and the main fun and gain comes
from mastering new design and programming techniques. Most experienced
programmers I have talked with quotes times from a half year to one and
a half year for becomming really comfortable with C++ and the key data
abstraction and object-oriented techniques it supports. That assumes
that they learn on the job and stay productive - usually by programming
in a ``less adventurous'' style of C++ during that period. If one could
devote full time to learning C++ one would be comfortable faster, but
without actual application of the new ideas on real projects that
degree of comfort could be misleading. Object-oriented programming and
object-oriented design are essentially practical - rather then
theoretical - disciplines. Unapplied, or applied only to toy examples,
these ideas can become dangerous ``religions.''<br>
</div>
<br style="font-weight: bold;">
<span style="font-weight: bold;">同样的,这视情况而定,这依您的经验以及您所谓的"学习C++"是什么而定,以较好
的C风格所需的语法及基础,加上定义并使用一些简单的类别来撰写C++,这些对于一个程式设计人员来说需要花上一到两个星期的时间,这还是简单的部份,主
要的困难、乐趣及获得,来自于新设计与编程技术,我所遇过大多数有经验的程式设计人员花了半年至一年半的时间,才得以真正熟悉C++、及它所支援的关键的
资料抽象化与物件导向技术。这是假设他们仍在职且持续保有生产力 -
在这段时间通常以"较不冒险"的C++风格来写作程式。如果有人能全心付出时间来学习C++,他会更快的熟悉,但是就没有办法在实际的专案上将新想法应用
上去,而熟悉的指数可能失去意义。物件导向编程与物件导向设计基本上是实用(而不是理论)法则,没有办法应用或只应用在一些玩具般的例子,这些想法可能变
成危险的"教条"。 </span><br>
<br>
Note that learning C++ is then primarily leaning programming and design
techniques, not language details. Having worked through a good
textbook I would suggest a book on design such as<br>
<br style="font-weight: bold;">
<span style="font-weight: bold;">注意到学习C++主要是学习编程与设计技术,而不是语言的细节,在看过一本好的书本
之后,在设计上我再建议这本: </span><br style="font-weight: bold;">
<span style="font-weight: bold;">Grady Booch: </span><br
style="font-weight: bold;">
<span style="font-weight: bold;">Object Oriented Design with examples </span><br
style="font-weight: bold;">
<span style="font-weight: bold;">Benjamin Cummings 1990. </span><br>
<br>
<div style="text-align: justify;">which has the nice property of having
longish examples in five different languages (Ada, CLOS, C++,
Smalltalk, and Object Pascal) and is therefore somewhat immune to the
language biogotry that mar some design discussions. The parts of the
book I like best is the presentation the design concepts and the
example chapters.<br>
</div>
<br>
<span style="font-weight: bold;">这本不错的地方在于有五种不同的程式语言撰写(Ada、CLOS、C++、
Smalltalk与Object
Pascal)的稍长范例,并且因此可以免于语言间的差异而有损于一些设计讨论,这本书我最喜欢的部份是设计观念的表现方式与范例章节。 </span><br>
<br>
Looking at design contrasts sharply with the approach of looking
very carefully at the details of the definition of C++ - usually using
the ARM<br>
<br style="font-weight: bold;">
<span style="font-weight: bold;">以细心观看C++定义细节的方式来看看设计合同 - 通常使用 ARM: </span><br>
<span style="font-weight: bold;">Ellist&Stroustrup: </span><br
style="font-weight: bold;">
<span style="font-weight: bold;">The Annotated C++ Reference Manual </span><br
style="font-weight: bold;">
<span style="font-weight: bold;">Addison-Wesley, 1990 </span><br>
<br>
<div style="text-align: justify;">which is a book containing much
useful information, but no information about how to write C++ programs.
A focus on details can be very distracting and lead to poor use of the
language. You wouldn't try to learn a foreign language from a
dictionary and grammar, would you?<br>
</div>
<br>
<span style="font-weight: bold;">这是一本包括相当有用资讯的书,但没有如何撰写C++程式的资讯。专注于细节会令人
困扰且导致以蹩脚的方式使用语言,您不会想尝试从字典与文法中开始学习一个外国语言吧,不是吗? </span><br>
<br>
<div style="text-align: justify;">When learning C++, it is essential to
keep the key design notions in mind so that one doesn't get lost in the
language technical details. That done, learning and using C++ can be
both fun and productive. A little C++ can lead to significant benefits
compared to C, further efforts to understand data abstraction and
object-oriented techniques yields further benefits.<br>
</div>
<br>
在学习C++时,谨记关键的设计概念是基本的,如此您才不会迷失在语言技术的细节中,一旦这么作后,学习与使用C++就会变得有趣且具有生产力,只要一点
点的C++就会比使用C得到更多的好处,进一步努力以了解资料抽象化与物件导向技术会获得更进一步的效益。 <br>
<br>
<span style="font-weight: bold;">- Bjarne Stroustrup </span><br>
<br>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -