BOO的例子 7

基于boo这个语言实现的几个dsl例子,可以作为我们学习的参考 

Brail

Castle Project

http://www.castleproject.org/monorail/documentation/trunk/viewengines/brail/index.html.

It’s a text templating language, built by me, in which in you can mix code and text freely. Here’s a sample:

<h1>My name is ${name}</h1>

<ul>

<% for element in list: %>

<li>${element}</li>

<% end %>

</ul>

Rhino ETL

Rhino ETL employs the concept of steps, with data flowing from one step to the next.

Usually the first step will extract the data from some source, and the last will load it to

the final destination.

Here’s an example of a full ETL process:

operationsplit_name:

for row in rows:

continue if row.Name is null

row.FirstName, row.LastName = row.Name.Split()

yield row

processUsersToPeople:

input "source_db", Command = "SELECT id, name, email FROM Users"

split_names()

output "destination_db", Command = """

INSERT INTO People (UserId, FirstName, LastName, Email)

VALUES (@UserId, @FirstName, @LastName, @Email)

""":

row.UserId = row.Id

This code gets the users list from the source database, splits the names, and then saves

them to the destination database. This is a good example of a DSL that requires some

knowledge of the domain before you can utilize it.

http://www.ayende.com/Blog/category/545.aspx

Bake (Boo Build System)

Task "init build dir":

if not Directory.Exists("build"):

MkDir "build"

CpFileSet("lib/*.dll").Files, "build", true

http://code.google.com/p/boo-build-system/

Specter

Specter is a behavior-driven development (BDD) testing framework

context "Empty stack":

stack as Stack

setup:

stack = Stack()

specifystack.Count.Must == 0

specify "Stack must accept an item and count is then one":

stack.Push(42)

stack.Count.Must == 1

http://behaviour-driven.org/

http://specter.sourceforge.net/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值