学习语言的境界
心如止水
我在努力学习C++,在我学了java和C#之后,典型的没事找抽型。
C++使我很迷茫。这个语言太复杂了,他涵盖的特性太多,领域太广。用这门语言,你可以做出世界上最帅的事情,也可以做出世界上最衰的事情。由于C和C++要求彼此兼容,所以项目中总是混杂不同风格的代码,结构化的,面向对象的,偏底层的,偏应用的。一个字,乱!完全没有在java平台下的感觉。
直到,我读到了这么一段话:
No programming language is perfect. Fortunately, a programming language does not have to be perfect to be a good tool for building great systems. In fact, a general purpose programming language can not be perfect for all of the many tasks to which it is put. What is perfect for one task is often seriously flawed for another because perfection in one area implies specialization. Thus, C++ was designed to be a good tool for building a wide variety of systems and to allow a wide variety of ideas to be expressed directly.
Not everything can be expressed directly using the built-in features of a language. In fact, that isn’t even the ideal. Language features exist to support a variety of programming styles and techniques. Consequently, the task of learning a language should focus on mastering the native and natural styles for that language – not on the understanding of every little detail of all the language features.
In practical programming, there is little advantage in knowing the most obscure language features or for using the largest number of features. A single language feature in isolation is of little interest. Only in the context provided by techniques and by other features does the feature acquire meaning and interest. Thus, when reading the following chapters, please remember that the real purpose of examining the details of C++ is to be able to use them in concert to support good programming style in the context of sound designs.
这是《The C++ Programming Language Special 3rd Edition》的一段话。如果是新手,像我一样对于C++众多的语言特性无所适从,就要特别注意中间红色的那段话。
如果真正理解了这段话,那么我们会一起热爱C++,甚至是java、C#。