最近在看这本书,比较实用。抽点时间把公开的部分内容简单的翻译了一下,下文是序部分。

书的具体地址为:

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

.Net元编程【Metaprogramming in NET】 序-翻译的更多相关文章

  1. 元编程 (meta-programming)

    元编程 (meta-programming) 术语 meta:英语前缀词根,来源于希腊文.中国大陆一般翻译成"元". 在逻辑学中,可以理解为:关于X的更高层次,同时,这个更高层次的 ...

  2. Scala Macros - 元编程 Metaprogramming with Def Macros

    Scala Macros对scala函数库编程人员来说是一项不可或缺的编程工具,可以通过它来解决一些用普通编程或者类层次编程(type level programming)都无法解决的问题,这是因为S ...

  3. C++ 元编程 —— 让编译器帮你写程序

    目录 1 C++ 中的元编程 1.1 什么是元编程 1.2 元编程在 C++ 中的位置 1.3 C++ 元编程的历史 2 元编程的语言支持 2.1 C++ 中的模板类型 2.2 C++ 中的模板参数 ...

  4. Python的元编程案例

    Python的元编程案例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.什么是元编程 元编程概念来自LISP和smalltalk. 我们写程序是直接写代码,是否能够用代码来生成 ...

  5. C++模板元编程(C++ template metaprogramming)

    实验平台:Win7,VS2013 Community,GCC 4.8.3(在线版) 所谓元编程就是编写直接生成或操纵程序的程序,C++ 模板给 C++ 语言提供了元编程的能力,模板使 C++ 编程变得 ...

  6. 翻译 - 元编程动态方法之public_send

    李哲 - MAY 20, 2015 原文地址:Metaprogramming Dynamic Methods: Using Public_send 作者:Friends of The Web的开发者V ...

  7. 模板元编程(Template metaprogramming)

    https://en.wikipedia.org/wiki/Template_metaprogramming 没看懂...只知道了模板元编程的代码是在编译期运行的... 敲了2个例子: 1. #inc ...

  8. atitit.元编程总结 o99

    atitit.元编程总结 o99.doc 1. 元编程(Metaprogramming) 1 2. 元编程的历史and发展 1 3. 元类型and元数据 1 4. 元编程实现方式 2 4.1. 代码生 ...

  9. C++学习笔记37:元编程

    元编程 什么是元编程(metaprogramming) 利用模板可以进行编译期计算(数值计算,型式计算和代码计算)的特点进行程序设计 为什么可以进行元编程? C++是两层语言:执行编译期计算的代码称为 ...

随机推荐

  1. 初探JavaScript(二)——JS如何动态操控HTML

    除去五一三天,我已经和<JavaScript Dom编程艺术>磨合了六天,第一印象很好.慢慢的,我发现这是一块排骨,除了肉还有骨头.遇到不解的地方就会多看几遍,实在不懂的先跳过,毕竟,初次 ...

  2. 材价看板(2)- 运行两周的kanban,改进的起点

    改进从何谈起?必须找到起点,那起点从哪来? 看板不需要像Scrum那样改变以往工作角色,简单通过任务上墙,配合敏捷的设计就能通过显示化日常工作来让问题自己蹦出来.在任何一个新采用看板的研发团队,执行一 ...

  3. 简单几步把LOGO变字体

    今天学到一招,所以决定简单写写如何利用图标字体生成器IcoMoon把自己制作的图标变成字体,下面以OSChina的图标为例. 一.确保logo转成纯色,并保存为svg格式 因为OSC的logo是绿色带 ...

  4. Swift的期待

    去年底苹果开源 Swift 之后,Google.Facebook和Uber三个互联网巨头就曾在伦敦召开会议讨论Swift在各自开发战略中的地位.近日业界有消息传出,谷歌有意考虑将Swift作为Andr ...

  5. C#--属性

  6. C# 3DES加密

    最近一个项目中,因为服务端是用的java开发的,客户端是用的C#,由于通信部分采用到了3DES加密,所以做个记录,以备以后需要的时候直接用. 这是对方(java)的加密算法,和网上流传的代码也差不多( ...

  7. 呼叫外部js文件并使用其内部方法

    很久没有学习jQuery了,都快忘记了.今天学习一个小功能,使用jQuery的$.getScript()方法,是读取外部js文件,读取之后,并执行js文件内的一个方法. 首先我们创建这个js文件,如i ...

  8. 将BootstrapJS和AngularJS结合使用以及为什么不用jQuery

    原文网址链接:http://ourjs.com/detail/54e18c51232227083e000034Bootstrap  和 Angular  都是人们大量使用的工具.在很多项目中,它们需要 ...

  9. 关于easyUI的模态对话框

    本文版权归博客园和作者吴双本人共同所有,转载和爬虫请注明原文地址.博客园蜗牛cnblogs.com/tdws 会用easyUI的模态对话框会是我们的开发更加简洁,只需下载这个插件,把需要的文件拖到项目 ...

  10. C#编程总结(十三)数据压缩

    C#编程总结(十三)数据压缩 在进行文件存储或者数据传输时,为了节省空间流量,需要对数据或文件进行压缩.在这里我们讲述通过C#实现数据压缩. 一.GZipStream压缩 微软提供用于压缩和解压缩流的 ...