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

书的具体地址为:

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. 35款加速网站开发的 CSS 开发工具

    网络有很很多的 CSS 工具和教程可用,它可以帮助设计人员和开发人员轻松.快速地学习 CSS 技术.这些工具中在高效开发 Web 应用程序中发挥重要作用. 在这篇文章中,我们收集了35个最好的 CSS ...

  2. 简单登录实例Login

    本人菜鸟~~学习过程中~~请求老大们指导!!谢谢!!! 从基础学习,坚持下去,每天进步一点点!! 1.首先要实现登录,通俗点总得有个登陆的样子吧,也就是人要有个脸面嘛!说做就做!自己属于菜鸟级别的,所 ...

  3. 【模式匹配】更快的Boyer-Moore算法

    1. 引言 前一篇中介绍了字符串KMP算法,其利用失配时已匹配的字符信息,以确定下一次匹配时模式串的起始位置.本文所要介绍的Boyer-Moore算法是一种比KMP更快的字符串匹配算法,它到底是怎么快 ...

  4. C# Socket系列二 简单的创建 socket 通信

    看了系列一 我们开启了对socket tcp的监听状态,那么这一章我们来讲解怎么创建socket的通信代码 我新建一个类 TSocketBase public abstract class TSock ...

  5. elasticsearch中的API

    elasticsearch中的API es中的API按照大类分为下面几种: 文档API: 提供对文档的增删改查操作 搜索API: 提供对文档进行某个字段的查询 索引API: 提供对索引进行操作 查看A ...

  6. openjudge7834:分成互质组 解析报告

    7834:分成互质组 总时间限制:  1000ms 内存限制:  65536kB 描述 给定n个正整数,将它们分组,使得每组中任意两个数互质.至少要分成多少个组? 输入 第一行是一个正整数n.1 &l ...

  7. SQL--Order By

    Order By--将当前查询出来的数据结果,进行排序,排序按照后面指定的列排序; DESC--倒序排序(降序); ASC--正序排序(升序); 汉字:用拼音的首字母排序,升序是从a--z;降序是从z ...

  8. 【原创】Kakfa log包源代码分析(二)

    八.Log.scala 日志类,个人认为是这个包最重要的两个类之一(另一个是LogManager).以伴生对象的方式提供.先说Log object,既然是object,就定义了一些类级别的变量,比如定 ...

  9. jQuery Ajax实现下拉框无刷新联动

    HTML代码: @{ Layout = null; } @using DAL; @using System.Data; @{ AreaDal areaDal = new AreaDal(); stri ...

  10. ios跑酷游戏源码完整版

    今天在网上看到了一个很流行的ios游戏源码,酷跑游戏源码,个人下载感觉非常不错,运行起来非常不错的,大家可以研究一下吧,由于源码文件较大,没有上传,请大家见谅. 由于文件较大,没有上传了,大家可以到这 ...