Monthly Archives: December 2011

Smalltalk: Links, News and resources (2)

Previous Post
Next Post

More links about Smalltalk, this time: Smalltalk tutorials and introductory articles.

Pharo by Example

Pharo the collaborActive book

Pharo Smalltalk screencasts

Videos: Learning Web Development with Seaside

Learn Smalltalk with ProfStef
Online, using Amber (Smalltalk translated to Javascript)

Why I love Smalltalk

Double dispatch

Class formats and CompiledMethod uniqueness

Departure: VM introduction

Magritte Tutorial

Some Persistency Approaches

Dynamic Web Development with Seaside

Messing with 3D in Dolphin Smalltalk

La magia del Smalltalk: Capítulo 8 – Algo útil con el #become:

La magia del Smalltalk: Capítulo 1 – ¡No entiendo nada!

La magia del Smalltalk: Capítulo 0

Smalltalk 4 U 3: Getting Started with GLASS and Pharo

Laser Game – A Development Example for Squeak 3.9

IBM Smalltalk Tutorial

One Assertion Per Test

Help for Etoys.

Video: Continuations and Subroutine Calls

Smalltalk Daily 07/21/10: Polymorphic Behavior

Smalltalk Television Video Collection

My Links Smalltalk Tutorials

More links about Smalltalk are coming.

Keep tuned!

Angel “Java” Lopez

COBOL: Links, News and Resources (1)

Next Post

More than 30 years ago, I wrote programs in COBOL, for IBM mainframes and other machines. Now, the language is alive and still in use. Some of my links:

COBOL (play /ˈkbɒl/) is one of the oldest programming languages. Its name is an acronym forCOmmon Business-Oriented Language, defining its primary domain in business, finance, and administrative systems for companies and governments.

The COBOL 2002 standard includes support for object-oriented programming and other modern language features.[1]


Visual COBOL integration with Visual Studio 2010

Java apps have most flaws, Cobol apps the least, study finds

RES – An Open Cobol To Java Translator

Koopa Cobol Parser

Why Cobol Modernization Is Relevant Today

Grace Hopper: Programming Pioneer


COBOL’s Not Dead. Make it Play Nice with the Modern Enterprise

COBOL – The New Age Programming Language

Micro Focus Announces CICS® for .NET

Net Express with .NET

Geriatric Java struggles to stay relevant

A Comparison Of .net COBOL, Visual Basic and C#

Ideone is something more than a pastebin; it’s an online compiler and debugging tool which allows
to compile and run code online in more than 40 programming languages.

The Future of the Mainframe

Enterprise Applications: 20 Things You Might Not Know About COBOL (as the Language Turns 50)

Open Source COBOL Compiler

COBOL to Java Automatic Migration with GPL’ed Tools

APL, COBOL, & Dijkstra

Free Cobol

The COBOL Programming Language

Cobol hits 50 and keeps counting


My Links

More links about programming languages are coming.

Keep tuned!

Angel “Java” Lopez

Smalltalk: Links, News and Resources (1)

Next Post

You know I was working on the implementation of my open source Smalltalk VM AjTalk (Recently, I was posting about translation from Smalltalk to Javascript). My first contact with Smalltalk was in the eighties, and since then, I was interested in it. It never become a “mainstream” programming language (yes, I know, it’s more than a programming language), and it suffered “balkanization” in its history, according to Ken Beck: many competing companies, implementing different VMs and class libraries (compare this with the unified history of Java, Ruby, Python, .NET, etc.). This is the first in a series of post about Smalltalk, this time: Smalltalk videos.

Alan Kay shares a powerful idea about ideas

Hitler se entera que Fidel habla de objetos en la Smalltalks


PharoCasts Basic UI building Videos

Physical EToys Team (Richo, Sebas y Gonzalo) – Ganadores del 1er Premio ESUG Innovation Award

Esteban Lorenzano – Ganador del 3er puesto de ESUG Innovation Award

The Amp Goes to 11: TDD in Smalltalk

Smalltalk Daily 07/21/10: Polymorphic Behavior

Dan Ingalls on the History of Smalltalk and the Lively Kernel

Video: Continuations and Subroutine Calls

Part of the series: Workshop on Self-sustaining Systems (S3) (SS 2008)

Self and Super: Explaining Method Lookup

Video: Associating Domain Objects with Components

Brian Foote and Dave West Discuss Craftsmanship;jsessionid=43251D6AF9D1103D73DDC8984A63CF0E

Failure: An Illustrated Guide

Smalltalk Daily 12/04/09: Multiple UIs, one Domain Model,_one_Domain_Model&entry=3437364817

“Introduction to GemStone” Videos

Smalltalk Daily 11/24/09: Overrides

Dan Ingalls: Seven (give or take) Smalltalk implementations

Smalltalk Daily 9/18/09: Exploring Objects

RailsConf 09: Robert Martin, “What Killed Smalltalk Could Kill Ruby”

Avi Bryant on Trendly, Ruby, Smalltalk and Javascript

Smalltalk Daily 9/22/08: Seaside Tutorial 1

CS 2340 – Smalltalk Tutorial – Creating a canvas

Video: Programando de a pares con Diogenes Moreira

QCon Keynote: Forty Years of Fun with Computers

Kinect and Etoys

Kinect and Etoys

Smalltalk Television

Videos: Learning Web Development with Seaside

IV Conferencia Internacional en la UTN _ Espone Andy Kellens de Bélgica- DIARIO LACALLE

Conferencia Internacional en la UTN- Hernán Wilkinson de FAST- DIARIO LACALLE

Messing with 3D in Dolphin Smalltalk

Object Arts, Videos

TDD Static vs. Dynamic – Parte 1/2

TDD Static vs. Dynamic – Parte 2/2

ESUG 2010 – Interview Smalltalk Community Argentina

My Links

More links about Smalltalk, AjTalk and Javascript are coming.

Keep tuned!

Angel “Java” Lopez

Node.js: Links, News and Resources (4)

Previous Post
Next Post

I want to extend the Social Gaming Toolkit to support Node.js as game server. Meanwhile, these are my new links about Node:

Node.js v0.6.5 Manual & Documentation

15 Papers you should read when interested in node.js’s background

Turing Machine, in Javascript and Node

nodeca / ndoc
js port of pdoc, with extentions

Announcing SilkJS
I am pleased to announce SilkJS, a V8 based Swiss Army Knife (and HTTP server).

Node.js modules you should know about: lazy

ecto / duino
Arduino framework for node.js

Blazing fast node.js: 10 performance tips from LinkedIn Mobile

Node.js Performance Tips from LinkedIn

c9 / nog
Nog is a simple node powered web log (aka blog) —

Understanding callback functions in Javascript

pekim / node-java
A bridge from node.js to a Java process

pekim / node-jdbc
Using JDBC from node

pekim / tedious
Node TDS module for connecting to SQL Server databases

Node.js Database Drivers

DrBenton / Node-DBI
A SQL database abstraction layer strongly inspired by the PHP Zend Framework Zend_Db API, with support of multiple Node.js database engines

Node.js isn’t cancer. Threads aren’t evil. The Node.js-is-cancer fibonacci server revisited.

Fabric Engine Benchmark: Node.js Fibonacci Server

joshfire / node-crawler
Web Crawler/Spider for NodeJS + server-side jQuery 😉

Dillinger is a cloud-enabled HTML5 Markdown editor.

Node.js for Java developers
Lightweight, event driven I/O for your web apps

Node.js vs Ruby On Rails

an unobtrusive framework initiative for node.js
Flatiron’s approach is to package simple to use yet full featured components and let developers subtract or add what they want.

node.js version selection

Node.js research

hookio /
a distributed EventEmitter and i/o framework for node.js

Node Toolbox

A short guide to Connect Middleware
Connect is an extensible HTTP server framework for node, providing high performance “plugins” known as middleware.

broofa / node-int64
Support for representing 64-bit integers in JavaScript

fifield / node-webcl
A WebCL implementation for node.js
WebCL is a set of bindings of OpenCL for JavaScript
OpenCL (Open Computing Language) is a framework for writing programs that execute across heterogeneous platforms consisting of CPUs, GPUs, and other processors.

cloudhead / http-console
simple, intuitive HTTP REPL — Speak HTTP like a local

A Read-Eval-Print-Loop (REPL) is available both as a standalone program and easily includable in other programs
Argentinean company working with Node.js

Parsing JavaScript with JavaScript

Debug node.js applications on Windows with iisnode integrated debugging

Creating a quick Todo listing app on Windows using IIS7, Node.js and Mongodb

The Node Beginner Book

Node Tuts

Mixu’s Node book

Helicon Zoo — a repository of web frameworks and applications for Microsoft IIS.
Including Pythong, Django, Ruby, Rails, Node.js, Perl

xk / node-sound
Sound library for Node

Using Node.js in an ASP.NET MVC application with iisnode

Node.js modules

arunoda / drev
DREV – Distributed Redis based EventEmitter for NodeJS

caolan / nodeunit
Easy unit testing in node.js and the browser, based on the assert module

My Links

More links about Node.js, Javascript, Node.js on Windows/Azure are coming.

Keep tuned!

Angel “Java” Lopez

Social Games Programming (Part 6) Testing Game and Service with TDD and QUnit

Previous Post
Next Post

In my previous post, I presented the new version of Windows Azure Toolkit for Social Games. It has simple games to demonstrate the use of Javascript, HTML 5 canvas, game moves processing, Azure worker roles and web roles. Let’s explore in this post the making of client game logic, in Javascript, using TDD and QUnit.

There are online tests at:

Let’s run the Tic Tac Toe Game Logic tests:

This page is using QUnit for client Javascript unit testing. I wrote about that library at:

TDD with Javascript and QUnit

The above page is testing the Tic Tac Toe logic. Remember, each game is implemented in parts, the logic is one of them:

The client code resides in TicTacToeGame.js inside the SocialGames.Web project. Their first lines:

TTTColor = { Empty: 0, Cross: 1, Circle: 2 };
function TicTacToeGame() {
    this.board = [
     [TTTColor.Empty, TTTColor.Empty, TTTColor.Empty],
     [TTTColor.Empty, TTTColor.Empty, TTTColor.Empty],
     [TTTColor.Empty, TTTColor.Empty, TTTColor.Empty]
TicTacToeGame.prototype.move = function (x, y, color) {
    this.board[x][y] = color;
TicTacToeGame.prototype.isEmpty = function (x, y) {
    return this.board[x][y] == TTTColor.Empty;

The client test page (TicTacToeGameTest.cshtml) was built at the same time, using a TDD (Test-Driven Development) approach. Look at first tests:

test("Create Empty Board", function () {
    var game = new TicTacToeGame();
    for (var x = 0; x < 3; x++)
        for (var y = 0; y < 3; y++)
            ok(game.isEmpty(x, y));
    equal(game.isTie(), false);
    equal(game.hasWinner(), false);
test("Valid Moves on Empty Board", function () {
    var game = new TicTacToeGame();
    for (var x = 0; x < 3; x++)
        for (var y = 0; y < 3; y++) {
            ok(game.isValid(x, y, TTTColor.Cross));
            ok(game.isValid(x, y, TTTColor.Circle));
test("No Winner in Empty Board", function () {
    var game = new TicTacToeGame();
    equal(game.getWinner(), TTTColor.Empty);
test("Get Winner in First Row", function () {
    var game = new TicTacToeGame();
    game.move(0, 0, TTTColor.Cross);
    game.move(1, 0, TTTColor.Cross);
    game.move(2, 0, TTTColor.Cross);
    equal(game.getWinner(), TTTColor.Cross);
    equal(game.isTie(), false);
    equal(game.hasWinner(), true);

The idea is to take baby steps, one test at a time, designing the game logic “API”, its expected behavior. In this way, you expend less time debugging in a dynamic language like Javascript, and you gain a test suite that can save your day in case of major refactoring. Look at the Four In A Row logic and client tests: you will find a similar approach.

Ok, not all can be easily tested, or build using TDD. Some of the game-agnostic services are using Ajax and Blob Storage, and to test them you must consider asynchronous Ajax calls. You can check:

(You must be logged in using your Facebook or Windows Live ID, an example of use of Federated Security and Access Control Service (ACS))

This time, the system under test is the game-agnostic Server Interface:

There are some tricks in the test code (ServerInterfaceTest.cshmlt), an excerpt:

test("Call User/Verify", function () {
    var success = function (result) { ok(true); start(); };
    var error = ajaxGetError;
    si.sendAjaxGet(apiURL + "user/verify", success);

expect is a QUnit function that prepare the framework to receive 1 ok(true) sometime during the test run. That confirmation is included in callback function success that it will be called after the successful processing of the asynchronous call .sendAjaxGet. Async life is not easy 😉

More code analysis is coming. And some adapt to use Node.js as game server.

Keep tuned!

Angel “Java” Lopez

AjLisp in Ruby (2) Context with Name and Values

Previous Post

One of the first classes I implemented in AjLispRb is the environment. This time I called it a context: a dictionary where to save name/values, to store the atom values. The code:

module AjLisp
class Context
    def initialize(parent = nil)
        @parent = parent
        @values =
    def getValue(name)
        if @values.has_key?(name)
            return @values[name]
        if @parent != nil
            return @parent.getValue(name)
        return nil
    def setValue(name, value)
        @values[name] = value

The class was coded using TDD, the first tests at test/test_context.rb. Some tests:

def test_not_defined_is_nil
    context =
def test_set_and_get_value
    context =
    context.setValue(:foo, "bar")
    assert_equal("bar", context.getValue(:foo))
def test_get_value_from_parent
    parent =
    parent.setValue(:foo, "bar")
    context =
    assert_equal("bar", context.getValue(:foo))

Initially, I used strings for names, but now I’m using Ruby symbols like :foo. I have a test that ensures the independence of parent and child context values:

def test_override_value_from_parent
    parent =
    parent.setValue(:foo, "bar")
    context =
    context.setValue(:foo, "bar2")
    assert_equal("bar2", context.getValue(:foo))
    assert_equal("bar", parent.getValue(:foo))

Each context can have a parent. There is a top context, defined in lib/ajlisp.rb:

module AjLisp
@context =
@context.setValue :quote, FPrimitiveQuote.instance
@context.setValue :first, PrimitiveFirst.instance
@context.setValue :rest, PrimitiveRest.instance
@context.setValue :cons, PrimitiveCons.instance
@context.setValue :list, PrimitiveList.instance
@context.setValue :lambda, FPrimitiveLambda.instance
@context.setValue :flambda, FPrimitiveFLambda.instance
@context.setValue :mlambda, FPrimitiveMLambda.instance
@context.setValue :let, FPrimitiveLet.instance
@context.setValue :define, FPrimitiveDefine.instance
@context.setValue :do, FPrimitiveDo.instance
@context.setValue :if, FPrimitiveIf.instance
@context.setValue :definef, FPrimitiveDefinef.instance
@context.setValue :definem, FPrimitiveDefinem.instance
@context.setValue :+, PrimitiveAdd.instance
@context.setValue :-, PrimitiveSubtract.instance
@context.setValue :*, PrimitiveMultiply.instance
@context.setValue :/, PrimitiveDivide.instance
def self.context
    return @context
# ...

New context are created in many primitives. At the begin, there is a top context like:

If you have a defined form that returns the second element of a list:

(define second (a) (first (rest a)))

now you have a top context with the new slot:

The top context has a new slot named second with a lambda value (lambda (a) (first (rest a))

When you invoke:

(second (quote (one two three)))

during the invocation a new context is created, its parent set to the top context, and having a new name/value pair:

That context is discarded after second evaluation (unless the context were referenced by recently created closure, details in upcoming post). When you define a simple value:

(define one 1)

the top context is modified, to have a new name/value pair:

Next topics: primitives and special form primitives, their invocation, closures, macros, native methods invocation.

Keep tuned!

Angel “Java” Lopez

AjCoRe, A Simple Content Repository (2) Stores

Previous Post

I did some advances in my open source project AjCoRe, simple implementation of a content repository written in C#:

If Content Repository is a new concept to you, check my links and Roy Fielding’s JSR-170 overview .

Key concepts: there are Workspaces. Each workspace has a Root Node. Each Node can have Child Nodes, and Properties. A Property has a Name and a Value:

In the above diagram, nodes and workspaces are represented by interfaces. The idea is to have different implementations of that abstractions. In my previous post, I presented two such implementations: one representing a file system, allowing only read only operations. And another implementation, a more extensible one, using arbitrary nodes in memory. Since then, I added the support of saving and retrieving those arbitrary nodes using a store.

Now, the project looks:


A: It is the concrete base implementation of workspace and nodes, based in memory, with the new support of having an optional store

B: The read-only implementation of workspace and nodes, representing an existing filesystem/directory

C: The new IStore (abstract) and the first concrete implementation, using a directory hierarchy and XML files to persists nodes in a workspace

D: The transaction support, during the lifetime of a session

Let’s see the new store capabilities. The Stores.IStore interface:

public interface IStore
    IEnumerable<string> GetChildNames(string path);
    PropertyList LoadProperties(string path);
    void SaveProperties(string path, PropertyList properties);
    void RemoveNode(string path);

Stores.Xml.Store is the first concrete implementation. Anyone could write another ones, using JSON, a relational database or a NoSQL backend. You can create, remove nodes, updated their properties, using a session, in the same way as in the previous post. BUT NOW, the workspace can be created injecting an IStore implementation in its constructor. Example (more details in the tests):

// Reference store in a directory
Store store = new Store("c:\\myworkspace");
// Workspace using that store to retrieve root node and their descendant
// (lazy loading)
Workspace workspace = new Workspace(store, "myws");
// Session accesing that workspace
Session session = new Session(workspace);
// You can use session to get the root node
// in case you have no direct workspace reference
INode root = session.Workspace.RootNode;
// Updates are made into a transaction
using (var tr = session.OpenTransaction())
    // Accessing a node
    INode node = root.ChildNodes["father"];
    // Changing a property
    session.SetPropertyValue(node, "Name", "Adam");
    // Creating a nodes    
    INode newnode = session.CreateNode(node, "newson", new Property[] {
                        new Property("Name", "Abel")
    // Removing a node

The tr.Complete()  is in charge of updating the XML files where the properties of nodes are saved. An example file:

<?xml version="1.0" encoding="utf-8"?>
  <Age type="int">35</Age>
  <Male type="bool">true</Male>
  <Hired type="datetime">2000-01-01T00:00:00</Hired>
  <Height type="double">167.2</Height>
  <Salary type="decimal">120000.5</Salary>

The key code in Transaction.Complete:

var nodestoupdate = 
    this.operations.Where(op => !(op is RemoveNodeOperation)).Select(op => op.Node).Distinct();
var nodestodelete = 
    this.operations.Where(op => op is RemoveNodeOperation).Select(op => op.Node).Distinct();
nodestoupdate = nodestoupdate.Except(nodestodelete);
foreach (var node in nodestoupdate), node.Properties);
foreach (var node in nodestodelete);

I could improve it, taken in account that some IStore implementation could prefer update each property, instead of a full node (I think in a database store).

I want to write another IStore implementation supporting JSON (I should design how to save the original type of each property). Other pending work: retrieve a node from a workspace using its full path, or query nodes (using XPath? Hmmm… I’m still in doubt).

Keep tuned!

Angel “Java” Lopez