程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> C#入門知識 >> .Net元編程【Metaprogramming in NET】 序-翻譯

.Net元編程【Metaprogramming in NET】 序-翻譯

編輯:C#入門知識

最近在看這本書,比較實用。抽點時間把公開的部分內容簡單的翻譯了一下,下文是序部分。

書的具體地址為:

http://www.amazon.cn/Metaprogramming-in-NET-Hazzard-Kevin/dp/1617290262/ref=sr_1_1?ie=UTF8&qid=1374625885&sr=8-1&keywords=Metaprogramming++in+.NET

 

對元編程這個問題,我從三個方面的經驗進行闡述:作為一個計算機科學家,業務開發員,以及。NET框架的作者。

從計算機科學的角度來看,從語言的角度來看,我們的行業已經基本停滯,而且是非常長的時間。緩慢演變3GLs(第三代語言)從C到Ç+ +到Java到Ç#已在逐步改善,但沒有在開發人員的工作效率,代碼的可維護性,減少復雜性,或其他有意義的指標方面的重大飛躍。

(在這個例子中我選擇的是C語言的進展,因為它也許是最廣為人知的。相對BASIC,Pascal和許多其他語言家族有可數量級的多。)

圍繞DSL和其他抽象的概念這些最終可能打破我們過去的20-30年3GL世界的概念,元編程提供了有趣的可能。這本書雖然不關注這樣一個長遠的目標,我覺得可以作為一個起點。在.NET中使用元編程來獲得有價值的觀點,可能會激發你想了解我們行業的未來無數的核心思想。

作為一個超過25年的業務開發員,我 已經看到元編程已經成為最主流和最重要的軟件開發工具之一。元編程可以用於代碼生成器,以及軟件在運行時可以動態調整其行為。

在20世紀90年代中期由微軟和其他人嘗試創建 “ 向導 ” 針對不同的業務應用場景生成代碼被人們嘲笑。今天,這樣的代碼生成工具,在如Ruby on Rails,Eclipse和Visual Studio這樣而環境下被認為是無價的。大多數企業開發人員每天依靠他們的工具在開發過程中所產生的大量的代碼和構建過程。

同樣,開發者依靠在運行時生成的代碼Mock框架測試,動態UI生成工具,規則引擎等這些工具工作。更微妙的方面,如使用內省(反射)來創建數據綁定框架,元編程是無孔不入。

這本書探討了用於實現代碼生成和動態應用程序的一些相關技術和方法,用於開發,構建和運行應用程序生命周期階段。了解這些概念,對有效地利用現有的工具很重要,同時對於創建您自己或改善那些存在工具的非常關鍵。

最後,作為廣泛使用的CLSA.NET業務對象框架的作者。我的框架內,我廣泛使用了許多在這本書中討論的技術,包括反射,動態類型裝載,和表達式樹。

如果沒有這些技術,沒有元編程的基本概念,就不會有CSLA.NET框架。CSLA.NET在這方面也不不是唯一的。許多數據層,業務層和表現層框架,大量使用元編程技術,在對象 - 關系映射,業務規則,驗證規則,數據綁定和動態UI生成方面提供靈活的支持。

在我看來,元編程是非常重要的,因為它的核心概念在流行的開發和測試的框架和工具中,以及為使代碼生成工具和動態應用行為中使用。這也是我們這個行業的未來,我們期待提高可維護性和降低軟件生命周期的的成本方法,元編程時最有前途的重點領域之一。

這本書作為開始理解和充分發揮元編程能力,是一個很好的方式。

 

ROCKFORD LHOTKA

首席技術官 AT MAGENIC

 

CSLA.NET框架作者 CSLA .NET是一個.NET軟件開發框架,幫助開發者“為Windows、Web、面向服務和工作流等應用構建強大和可維護的業務邏輯層”。 CSLA是Component-based, Scalable, Logical Architecture的簡寫,CSLA . NET是Rockford Lhotka基於.Net設計的一套N-tier分布式框架。

http://www.cslanet.com/

 

--如下是原文

foreword

When I think about metaprogramming I view it through three sets of experience: as a computer scientist, a business developer, and a .NET framework author.

From a computer science perspective, it is clear that our industry has been largely stagnant from a language perspective for an extremely long time. The slow evolution of  3GLs (third-generation languages) from C to C++ to Java to C# has resulted in incremental improvements, but no major leaps in terms of developer productivity, maintainability of code, reduction of complexity, or other meaningful metrics.

  (I chose the C language progression in my example because it is perhaps the most widely known. Comparable progressions exist for BASIC, Pascal, and many other language families.)

Metaprogramming offers interesting possibilities around the creation of domain-specific languages and other abstraction concepts that could eventually break us out of the 3GL world we’ve lived in for the past 20-30 years. Although this book doesn't focus on such a long-term goal, I think you can use Metaprogramming in .NET as a starting point to gain valuable perspective on myriad core ideas that might inspire you to think more about the future of our industry.

As someone who’s been a business developer for over 25 years, I’ve watched as metaprogramming has become one of the most mainstream and important tools for software development. Metaprogramming enables development time code generation as well as software that can dynamically adapt its behaviors at runtime.

In the mid-1990s people mocked attempts by Microsoft and others to create “wizards” that generated code for various business application scenarios. Today, such code generation tools are considered invaluable in environments as varied as Ruby on Rails, Eclipse, and Visual Studio. Most business developers rely daily on massive amounts of code generated by their tools during the development and build process.

Similarly, developers rely on runtime-generated code created by test mocking frameworks, dynamic UI generation tools, rules engines, and more. Even more subtle aspects of metaprogramming, such as the use of introspection (reflection) to create data binding frameworks, are pervasive.

This book explores a number of the underlying technologies and techniques used to implement code generation and dynamic applications during the development, build, and runtime phases of an application’s lifecycle. Understanding these concepts is important for effective use of existing tools, and critical for creating your own or improving those that exist.

Finally, I am the author of the widely used CSLA .NET business objects framework.  Within my framework I make extensive use of many of the techniques discussed in this book, including reflection, dynamic type loading, and expression trees.

A framework such as CSLA .NET couldn’t exist without these technologies, and without the basic concepts of metaprogramming. Nor is CSLA .NET unique in this regard. Many frameworks in the data layer, business layer, and presentation layer make heavy use of metaprogramming techniques to provide broad and flexible support for object-relational mapping, business rules, validation rules, data binding, and dynamic UI generation.

In my view, metaprogramming is extremely important because its core concepts are used in popular development and testing frameworks and tools, as well as to enable code generation tooling and dynamic application behaviors. It is also one of the most promising areas of focus for the future of our industry as we look for ways to improve maintainability and reduce the cost of software over its lifetime.

This book is an excellent way to get started down the road of understanding and fully using the power of metaprogramming.

ROCKFORD LHOTKA

CTO AT MAGENIC

CREATOR OF THE CSLA .NET FRAMEWORK

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved