.Net元编程【Metaprogramming in NET】 序-翻译

简介: 最近在看这本书,比较实用。抽点时间把公开的部分内容简单的翻译了一下,下文是序部分。 书的具体地址为: 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   序 对元编程这个问题,我从三个方面的经验进行阐述:作为一个计算机科学家,业务开发员,以及。

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

书的具体地址为:

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

相关文章
|
移动开发 API
四:net core(.NET 6)使用Filter过滤器拦截webapi方法
Filter的基本用法 :代码在最下方使用filter过滤器,来实现拦截接口信息。咱们先新建一个项目,在原有的webapi上面,选择添加项目,添加一个类库项目
977 0
四:net core(.NET 6)使用Filter过滤器拦截webapi方法
|
消息中间件
一起谈.NET技术,NET下RabbitMQ实践 [WCF发布篇]
  在之前的两篇文章中,主要介绍了RabbitMQ环境配置,简单示例的编写。今天将会介绍如何使用WCF将RabbitMQ列队以服务的方式进行发布。  注:因为RabbitMQ的官方.net客户端中包括了WCF的SAMPLE代码演示,很适合初学者,所以我就偷了个懒,直接对照它的SAMPLE来说明了,算是借花献佛吧,呵呵。
1159 0
|
消息中间件
一起谈.NET技术,NET下RabbitMQ实践 [示例篇]
在上一篇文章中,介绍了在window环境下安装erlang,rabbitmq-server,以免配置用户,权限,虚拟机等内容。今天将会介绍如果使用rabbitmq进行简单的消息入队,出队操作,因为本文演示的环境要用到上文中配置的环境,所以要运行本文sample,请先按上一篇中完成相应环境配置。
1000 0
|
消息中间件 Web App开发 数据安全/隐私保护
一起谈.NET技术,NET下RabbitMQ实践 [配置篇]
这个系列目前计划写四篇,分别是配置,示例,WCF发布,实战。当然不排除加餐情况。      介绍:      rabbitMQ是一个在AMQP协议标准基础上完整的,可服用的企业消息系统。他遵循Mozilla Public License开源协议。
1192 0
|
消息中间件 监控 NoSQL
一起谈.NET技术,NET 下RabbitMQ实践 [实战篇]
  之前的文章中,介绍了如何将RabbitMQ以WCF方式进行发布。今天就介绍一下我们产品中如何使用RabbitMQ的!  在Discuz!NT企业版中,提供了对HTTP错误日志的记录功能,这一点对企业版非常重要,另外存储错误日志使用了MongoDB,理由很简单,MongoDB的添加操作飞快,即使数量过亿之后插入速度依旧不减。
764 0
|
PHP Windows
一起谈.NET技术,使用DeeepZoom Composer进行富图像应用的开发(翻译--2)
  Deep Zoom程序设计      到目前为止,你已经见识了Deep Zoom Composer工具,也见到了Deep Zoom 多图像的浏览器应用程序。不过你可能还需要知道怎样设计这样的程序。   因此,在这一节中,你将能够在Silverlight中开发Deep Zoom程序,可以用Deep Zoom Composer工具来创建图像瓷片,而且你也能够将它们集成到你自己的Silverlight应用程序中,下面的过程将显示MultiScaleImage控件来展示这个过程。
1024 0
|
Web App开发 PHP
一起谈.NET技术,使用DeeepZoom Composer进行富图像应用的开发(翻译--1)
  富图像应用(第一部分)   在这章,你会学到下列内容: 使用Deep Zoom Composer 工具建立高质量、高度友好的图像。 组合为平滑、可缩放的全景图像。 建立以编程形式方式控制的深度缩放的Silverlight应用程序。
1105 0
|
前端开发 .NET
ASP.“.NET研究”NET MVC 3 —— Model的使用?
  昨天博客发了新文章,讲一下我对如何使用MVC中的Model的看法,不是什么大技术,当是一个技术讨论^^   原文地址:http://www.youguanbumen.net/Article.aspx?id=79   原文:   前两天写了个文章ASP.
1214 0
浅析.“.NET研究”NET开发过程中命名的数量和人称
  我们都明白命名的重上海闵行企业网站制作lor:white;' href='http://www.93tj.com'>上海企业网站制作要性,如果对命名不断地关注,就需要考虑命名中的动词和名词,特别的情况是动词的人称和名词的数量。
744 0
|
前端开发 .NET Linux
ASP.“.NET研究”NET MVC3 on Mono的折腾(二):Linux(openSUSE)下的部署
  续上篇介绍Mono在Window下的部署,对于我而言,相比于Windows平台下的部署,Linux平台下的部署挑战性会更大一点。从来没有Linux使用经验的我,要在Linux下部署Mono,遇到的不仅仅是Mono部署的问题,还有各种Linux操作的问题。
1319 0