11-24

协调性:微软已经意识到了开发者拥有巨大的代码以及现有组件。如果要重写这些代码或者组件以便在.net平台上使用,那这将会是一个非常巨大的工程,而且会降低该平台的推广。所以.net framework完全支持现有DLL重的COM组件以及WIN32的一些功能。

Users won't directly appreciate the CLR and its capabilities, but they will certainly notice the quality and features of applications that utilize the CLR. In addition, users and your company's bottom line will appreciate how the CLR allows applications to be developed and deployed more rapidly and with less administration than Windows has ever allowed in the past.

The development environment: Microsoft visual studio

The goal of this book

Sample code and system requirement

The book has no mistakes

Acknowledgements

Support

实在是不想在翻了,没啥实质性的东西,索性直接跳了过去,终于要到正文部分了,这下可要一字一句理解了。

Part1

The CLR’s Execution model

The Microsoft .NET Framework introduces many new concepts, technologies, and terms. My goal in this chapter is to give you an overview of how the .NET Framework is designed, introduce you to some of the new technologies the framework includes, and define many of the terms you'll be seeing when you start using it. I'll also take you through the process of building your source code  into an application or a set of redistributable components (files) that contain types (classes, structures, etc.) and then explain how your application will execute.

这个平台有许多的新新概念。

Compiling source code into managed modules

这下可好了,你终于要使用.net来作为你的开发平台啦。棒极了!第一步,你首先要决定好你想用那种组件或者应用程序来进行你的开发。让我们假设一下你已经准备好了这一些细节性的问题;一切都是设计嘛,说明书有详细说明,现在你就要开始开发了。

Now you must decide which programming language to use. This task is usually difficult

because different languages offer different capabilities. For example, in unmanaged C/C++,

you have pretty low-level control of the system. You can manage memory exactly the way you

want to, create threads easily if you need to, and so on. Microsoft Visual Basic 6, on the other

hand, allows you to build UI applications very rapidly and makes it easy for you to control

COM objects and databases.

不同语言侧重点有所不同。

The common language runtime (CLR) is just what its name says it is; a runtime that is usable by

different and varied programming languages. The features of the CLR are available to any and all

programming languages that target itperiod. For example, the runtime uses exceptions to

report errors, so all languages that target the runtime also get errors reported via exceptions.

Another example is that the runtime also allows you to create a thread, so any language that

targets the runtime can create a thread.

CLR的通用性,任何target CLR的语言。

In fact, at runtime, the CLR has no idea which programming language the developer used for

the source code. This means that you should choose whatever programming language allows

you to express your intentions most easily. You can develop your code in any programming

language you desire as long as the compiler you use to compile your code targets the CLR.

CLR不知道你是用什么语言的,因为他们最终都要被解释成IL。

So, if what I say is true, what is the advantage of using one programming language over another?

Well, I think of compilers as syntax checkers and "correct code" analyzers. They examine your

source code, ensure that whatever you've written makes some sense, and then output code that

describes your intention. Different programming languages allow you to develop using different

syntax. Don't underestimate the value of this choice. For mathematical or financial applications,

expressing your intentions by using APL syntax can save many days of development time when

compared to expressing the same intention by using Perl syntax, for example.

不同的语言他们都要确保无语法错误,而且语言的强项是不同的。

Microsoft has created several language compilers that target the runtime: C++/CLI, C#
(pronounced "C sharp"), Visual Basic, JScript, J# (a Java language compiler), and an Intermediate
Language (IL) Assembler. In addition to Microsoft, several other companies, colleges,
and universities have created compilers that produce code to target the CLR. I'm aware of
compilers for Ada, APL, Caml, COBOL, Eiffel, Forth, Fortran, Haskell, Lexico, LISP, LOGO,
Lua, Mercury, ML, Mondrian, Oberon, Pascal, Perl, Php, Prolog, Python, RPG, Scheme,
Smalltalk, and Tcl/Tk.

很多语言都是target CLR的。

 

 Native code compilers produce code targeted to a specific CPU architecture, such as x86, x64,
or IA64. All CLR-compliant compilers produce Intermediate Language (IL) code instead. (I'll
go into more detail about IL code later in this chapter.) IL code is sometimes referred to as
managed code because the CLR manages its execution.

所有CLR编译的语言都是要产生IL滴。

c

IL和metadata密不可分啊~

Metadata has many uses. Here are some of them:
• Metadata removes the need for header and library files when compiling because all the
information about the referenced types/members is contained in the file that has the IL
that implements the type/members. Compilers can read metadata directly from managed
modules.

编译器能直接读元数据,所以元数据会把一些不必要的header和库文件移走。
• Microsoft Visual Studio uses metadata to help you write code. Its IntelliSense feature
parses metadata to tell you what methods, properties, events, and fields a type offers,
and in the case of a method, what parameters the method expects.

Visual Studio中的智能感应也是metadata在起作用呢。
• The CLR's code verification process uses metadata to ensure that your code performs
only "safe" operations. (I'll discuss verification shortly.)

是Metadata在确保整个代码是“安全”的。
• Metadata allows an object's fields to be serialized into a memory block, sent to another
machine, and then deserialized, re-creating the object's state on the remote machine.

序列化与反序列化也是元数据在起作用。
• Metadata allows the garbage collector to track the lifetime of objects. For any object, the
garbage collector can determine the type of the object and, from the metadata, know
which fields within that object refer to other objects.

metadata使得GC追踪某个object的生命周期,而且可以知道引用它的那个object.

 

posted @ 2009-11-24 17:48  Tmac_  阅读(208)  评论(0)    收藏  举报