This is the slide of the session on "IT Benkyo Enkai 60" held on December 27, 2017 at Osaka, "Lean Architecture / DCI Evening Report" by Atsuhiro Kubo @iteman.
The document provides an overview of domain-specific languages (DSLs) and language-oriented programming. It discusses how DSLs are specialized computer languages for a particular domain and provides examples of DSLs. It also describes how language-oriented programming uses DSLs to define programming abstractions and implementations through language tools and workbenches. Finally, it outlines how a DSL for object-relational mapping was developed in PHP using a lexer, parser, and Eclipse integration.
The document describes Piece Framework 2.0. It includes copyright notices and discusses domain specific languages, textual modeling frameworks, generative programming, and language workbenches in the context of the framework. Key components of the framework include Piece_Unity, Piece_ORM, Piece_Right, Piece_Flow, and Stagehand_FSM.
21. PHPUnit
class StackTest extends PHPUnit_Framework_TestCase
{
public function testPushAndPop()
{
$stack = array();
$this->assertEquals(0, count($stack));
array_push($stack, 'foo');
$this->assertEquals('foo', $stack[count($stack)-1]);
$this->assertEquals(1, count($stack));
$this->assertEquals('foo', array_pop($stack));
$this->assertEquals(0, count($stack));
}
22. Behat
Feature: ls
In order to see the directory structure
As a UNIX user
I need to be able to list the current directory's contents
Scenario:
Given I am in a directory "test"
And I have a file named "foo"
And I have a file named "bar"
When I run "ls"
Then I should get:
"""
bar
foo
"""
23. PHPSpec
class DescribeNewBowlingGame extends PHPSpecContext
{
private $_bowling = null;
public function before()
{
$this->_bowling = $this->spec(new Bowling);
}
public function itShouldScore0ForGutterGame()
{
for ($i=1; $i<=20; $i++) {
// someone is really bad at bowling!
$this->_bowling->hit(0);
}
$this->_bowling->score->should->equal(0);
}