Inside c#(Foreword)_2
Simple Preservation
Hippocrates said, “Make a habit of two things: to help, or at least do no harm.” The “do no harm” part played a prominent role in our design of C#. If a C or C++ feature addressed a problem well, we kept it without modification. Most significantly, C# borrows from C and C++ in core areas such as expressions, statements, and overall syntax. Because so much of a typical program consists of these features, C and C++ developers instantly feel comfortable with C#.
简洁的保留
Hippocrates说过:“让习惯有两种状态:有帮助,或至少无损害”。我们在设计C#时尤其关注“无损害”这一部分。如果C/C++的摩伊功能能够很好的解决问题,我们将保留它并不作修改。更值得关注的是C#引入了C/C++的核心,例如表达式、语句以及总体的语法。因为典型的程序一般都有这些部分组成,所以C/C++程序员能够很快适应C#。
Incremental Improvement
Many incremental improvements have been made—too many to mention in this brief foreword—but it’s worth calling attention to a few changes that eliminate some common and time-consuming C and C++ errors:
增加的改进
增加的改进太多而无法在序言中一一列举,但是几个消除了C/C++中易犯的耗费时间的错误的改进值得关注:
Thoughtful Innovation
Deeper innovation is found in C#’s type system, which includes the following advances:
Scott Wiltamuth
Visual C# .NET Group Program Manager
Microsoft Corporation
有思想性的创新
C#的类型系统包含了几个重大的创新,主要有以下几点:
(后面的部分主要是进一步说明C#的优点和本书的优点,不翻了,自己看吧!)
Inside C#
I claim that forewords are perhaps the most difficult rhetoric to write. Consider for a moment that with a foreword you have a very limited amount of space in which to write a compelling “introduction” that conveys both the breadth and depth of the book and that also speaks to the care with which it was written. To do this successfully, I’m of the firm belief that a foreword needs a theme, a pervasive idea that can be summed up in a single sentence. That sentence for Inside C# is, “It’s about the details.”
Scott has done an awesome job talking about why C# is a great language; now I want to spend a bit of time talking about why reading Inside C# is a great way to learn it. I’ve spent a lot of time programming in many languages over the years, and I have learned two indelible truths: it is impossible to write the “best” code, and it’s only possible to write “better” code when you know the details. Let me explain the first statement a bit. As soon as a software project grows over a 100 lines or so, the domain of possible correct implementations—a correct implementation being one that gets the job done—increases to such a large number that it’s essentially impossible to find the one that solves that domain space in the fastest, most efficient way possible. Even disregarding what people consider the best solution—“mine only has one line of code and is easily maintainable!” and “mine has 300 lines of code but executes 30 times faster!”—it should be obvious that our job as software engineers is to come up with a good solution, not necessarily the best.
Which brings me to my second point: the good solution cannot be found without knowing what bits to twiddle. Don’t get me wrong; it’s also impossible to write good code without good algorithms. But regardless of what those algorithms are, if they’re implemented without knowledge of both the platform and language, I guarantee that taking that code one step closer to the perfect solution would be as easy as changing a class to a struct. And that leads us right back to exactly why Inside C# is well worth the read—because Tom delves into the details, and in the end the details lead to better code.
Anson Horton
Visual C# .NET Program Manager
Microsoft Corporation
浙公网安备 33010602011771号