Effective C# 原则50:了解ECMA标准
Item 50: Learn About the ECMA Standard
ECMA标准是C#语言所有功能的官方说明。ECMA-334定义了C#语言1.0的标准,你可以从The C# Programming Language这本书上学习C#2.0的计划(译注:现在已经不是计划了),这本书的作者是Anders Hejlsberg, Scott Wiltamuth, 和 Peter Golde (Addison-Wesley, 2003)。这本书是一个语言手册,而不是指南。它详细说明了这门语言书面定义的每一个功能。每一种语言都只一种标记,可以让你更加明白每一种语言的功能。当我还在写这本书的时候,我还经常把这书放在我的桌子上参考。
如果你认真的C#程序员,你应该明白这门语言,包括在不同功能后面的基本原理。如果在你工作的时候,你知道在什么时候应用每一个功能,它就会让你的工作更容易。你可以更好的理解隐藏在不同语言表达式后的每一个不同细节。
对于C#的附带内容,你应该彻底的明白公共运行时(CLR)。CLR以及公共语言基础(CLI)标准在ECMA-335中有定义,这也是CLR标准。做为C#,这还是1.0的标准。公共语言基础标记标准这一书(The Common Language Infrastructure Annotated Standard),由ames Miller 和Susann Ragsdale (Addison-Wesley, 2003)所著,解说了CLI的2.0版本。这是一本包括公共语言子系统(CLS)的使用手册,这会帮助理解CLS遵从性(译注:前几天才看到MSDN上把compliance翻译为遵从性,而我一直理解为兼容性,当然兼容性有其它的词,很多时候是理解的问题。)的背后原则。这同样可以帮助你明白.Net运行时和基础的ECMA标准。
C#和CLR委员会还在发布工作文档,用于讨论的发展C#语言的2.0版本以及CLR。这些讨论对于明白C#今后会如何发展以及改变是很有价值的。
另处,深刻理解当前的标准以及增加的意图可以帮助你创建经得起时间考虑的代码。通过理解这些可能添加到语言以及进行环境上的功能,你可以在创建软件时立于一个有利的位置上,而且可以持续更久。你可以预料到一些可能因某些必然因素而做出的修改。
软件设计随时在改变,C#也会发展和改变,很可能过时候就会在2.0上发展几个版本。这是一个工具,你可以每天都利用它,至少是大多数日子。学习更多的官方说明,而且总是站在这些内容的最项上。
==========================
Item 50: Learn About the ECMA Standard
The ECMA standard is the official word on how every feature in the C# language behaves. ECMA-334 defines the 1.0 standard for the C# language. You can learn about the C# 2.0 proposals from the book The C# Programming Language, by Anders Hejlsberg, Scott Wiltamuth, and Peter Golde (Addison-Wesley, 2003). This book is a language reference, not a tutorial. It explains in very pedantic detail exactly how each feature of the language works. Each language feature is annotated so that you can better understand the justification of each language feature. While I was working on this book, I constantly had this reference open on my desk.
If you are a serious C# programmer, you should understand the language, including the rationale behind different features. It will make your job easier if you know when to apply each feature in your own work. You will have a better understanding of any subtle differences in different language expressions.
In addition to the C# language, you should understand the Common Language Runtime (CLR) thoroughly. The CLR and Common Language Infrastructure (CLI) standards are defined in ECMA-335, the CLR standard. As with C#, this is version 1.0 of the standard. The Common Language Infrastructure Annotated Standard, by James Miller and Susann Ragsdale (Addison-Wesley, 2003), explains the CLI version 2.0. This reference includes the Common Language Subsystem (CLS), which will help you understand the rules behind CLS compliance. This also helps you understand the ECMA standard for the .NET runtime and infrastructure.
Both the C# and CLR committees continue to publish working documents on the discussion and progress of the 2.0 version of the C# language and the CLR. The discussions are a valuable way to understand how C# will grow and change over time.
In addition, a deeper understanding of the current standard and the proposed enhancements will help you create code that stands the test of time. By understanding the features that will be added to the language and the environment, you are in a better position to create software that lasts longer into the future. You can anticipate the future modifications that might be necessary.
Software changes over time. C# will grow and change, probably for some time and for several revisions after 2.0. This is a tool that you use every day, for most of your day. Learn the official definitions, and stay on top of them.