Monthly Archives: September 2012

TDD: Links, News And Resources (5)

Previous Post

You know: production code without TDD is condemned by Geneva Convention ;-). More resources about one of my favorites topics:

mfncooper / sidedoor
Exposing a secondary API for your Node.js modules

Kata – the Only Way to Learn TDD
Test Driven Development in PHP

Unit testing in node.js

Unit testing node.js apps

Test Driven Development in Python

Ruby, Setting $stdout per-thread

TATFT — I feel a revolution coming on

Just enough testing

Testing like the TSA

ELisp Testing

Jasmine is a behavior-driven development framework for testing your JavaScript code.

Why I hate Test Driven Development

How to not solve a Sudoku

Sudoku 4: Disaster Narrowly Averted
Sudoku: Learning, Thinking and Doing Something About It

Moving On With Sudoku

OK, Sudoku

ASP.NET Web Forms 4.5, MVVM and Testability
MS Test, el framework de test de Visual Studio 2010

Erlang EUnit – introduction

My Links

Keep tuned!

Angel “Java” Lopez

SimpleGA (1) Genetic Algorithms in Javascript/Node.js

Two week ago, I was writing:

a Simple Genetic Algorithm base framework, that supports population, evaluation and mutator operators (I should add crossover operators). The base algorithm is based on

A Genetic Algorithm Tutorial (pdf)

You can create a population of genotypes, each one with an evaluation function. The library evaluates each genotypes and prepares another population, based on the value of each genotype, copying the best ones, and mutating some of the initial specimen based on fitness. The fitness value is v = fi / fa, where fi is the individual fitness evaluation, and fa is the fitness average. The integer part of v determines the count of copies of an individual that survives to the next generation. The fraction part is the probability of having a mutated copy in the next generation set of genotypes:

var newpopulation = [];

for (var k = 0; k < l; k++) {
	if (values[k] < 0)
	var fitness = values[k] / total;
	if (fitness < 0)
	var ntimes = Math.floor(fitness);
	var fraction = fitness - ntimes;
	for (var j = 0; j < ntimes; j++)
	if (fraction > 0 && Math.random() <= fraction)

if (mutators && mutators.length > 0) {
	l = newpopulation.length;
	var lm = mutators.length;
	for (k = 0; k < l; k++) {
		var mutator = mutators[Math.floor(Math.random() * lm)];
		newpopulation[k] = mutator.mutate(newpopulation[k]);

(I should add crossover operator support). There is a sample implementing the Travelling Saleman Problem

running in console using

It can run from the console, or you can launch a local web page:

I wrote client/server version (web page at browser, Node.js server program) and a distributed version (the evaluation of many population running in many server nodes, coordinated by a Node.js server, showing results in a browser).

Next steps: add crossover operators, sample short descriptions, more samples.

Keep tuned!

Angel “Java” Lopez

Genetic Algorithms: Links and resources (1)

These days, I wrote a simple genetic algorithm in Javascript, runing at browser, and at server (Node.js), even with distributed load (see I should write a post about that code (my previous posts with experiments in C#), but first, I want to share some of my genetic algorithm links:

In the computer science field of artificial intelligence, a genetic algorithm (GA) is a search heuristic that mimics the process of natural evolution. This heuristic is routinely used to generate useful solutions to optimization and search problems. Genetic algorithms belong to the larger class of evolutionary algorithms (EA), which generate solutions to optimization problems using techniques inspired by natural evolution, such as inheritance, mutation, selection, and crossover.

Robocode with JGAP

Andy’s Genetic Programming- GPQuick and Doodle Garde

Genetic Algorithms: Cool Name & Damn Simple

Local Optimization Software

E-Book "Global Optimization Algorithms — Theory and Application"
This book elaborates on many of the basic principles in global optimization, Evolutionary Algorithms, and Genetic Programming.

Evolvable Hardware

Genetic A/B Testing with JavaScript

Introduction to Genetic Algorithms
Genetic Programming: Evolution of Mona Lisa

Time for Genetic Programming?

Help! My Product Development is Going TOO FAST
Use evolution: We can build a machine that evolves the product by user-testing variations.

Discipulus 5 Genetic Programming Predictive Modelling
Genetic Algorithm Library


Genetic Algorithms

An Introduction to Genetic Algorithms In Java

Survival of the Fittest: Natural Selection with Windows Forms
What is Genetic Programming?

Genetic Algorithms

Global Optimization Toolbox

Travelling salesman problem
A C++ Library of Genetic Algorithm Components

My Links

Keep tuned!

Angel “Java” Lopez

New Month’s Resolutions: September 2012

Time to write the new month’s resolutions. First, the past month review:

– Start to prepare talk Python Argentina [complete]
– Work on PythonSharp [pending]
– Write a new post about TDD [complete] see post
– Continue to prepare a talk about code generation in Ruby [complete]
– Start to prepare talk about distributed applications (examples in NodeJs) [complete]

I was busy in my non-technical resolution (see Spanish post).

Resolutions for September:

– Give a talk about distributed applications
– Give a talk about TDD for .NET
– Continue working on PythonSharp
– Continue preparing the talk about code generation in Ruby
– Continue preparing my talk for Python Argentina
– More work on AjConsorSite
– Work on AjContab (PHP version)
– Work on AjTalk for Java

Keep tuned!

Angel “Java” Lopez