Zerobase Dev Blog

コードネームYentry

GLASS (GemStone, Linux, Apache, Seaside, and Smalltalk) によるテスト駆動プロトタイピングへ

Play (Scala) + Redisで作ろうかと思っていたのですが、『データベースを使った永続化への復讐』などという考えに至り、もっぱらJava/Scalaの永続化技術について調べていたものの、これというものが見つかりませんでした。ところがSmalltalkにすごいものがありました。

Scalaを学んで関数型プログラミングパラダイムを魅力的だと考えていましたが、優先度はオブジェクト指向のほうが高いですから、SmalltalkベースのGLASSを調べています。永続化を気にせず、快適に「テスト駆動プロトタイピング」(TDP: test-driven prototyping)できそうです。

GLASS – GemStone, Linux, Apache, Seaside, and Smalltalk – provides a powerful new way to rapidly create and deploy desktop-like web applications. GLASS makes GemStone's transparent persistence, enterprise scalability, and legendary reliability available to web application developers. By using GLASS, you can focus on developing your application, and not spend any time on complex Object-Relational mapping or other persistence schemes. [GemStone Seaside | About]

なお、DSLのホスト言語としても、Smalltalkは十分な表現力を持っています。Scalaと同等の表現力は備えている、と評価しています。以下はMocketryのStateSpec DSLの例です:

5 should equals: 5.
5 should be an instance of: SmallInteger.
[1 / 0] should raise: ZeroDivide.
6 should not equals: 5.
5.0 should not be an instance of: SmallInteger.
[1 / 1] should not raise: ZeroDivide.

(cite)

Behaviour specificationsの書き方は以下のようになります:

OrderTests >> testIsFilledIfEnoughInWarehouse
    |order|
    order := Order on: 50 of: #product.
    [:warehouse|
        [order fillFrom: warehouse]
        should satisfy:
        [(warehouse has: 50 of: #product) will Return true.
         warehouse remove: 50 of: #product]
    ] runScenario.
    self assert: order isFilled.

(cite)

いろいろと調べたり学んだりするなかで、あらためて自分が「プロトタイピング」を製品構想・設計・開発の中核に置いているのだと再確認しました。デザイン思考的と言ってもよいのですが。

see also: - ウェブとデスクトップでの永続化の意味論

関連情報

GLASS/Seaside

TDD

Smalltalk