Angel \”Java\” Lopez on Blog

July 19, 2014

SharpGo Implementing Go in C# (1) The Project

Filed under: .NET, C Sharp, Go, Google, Open Source Projects, Programming Languages, SharpGo — ajlopez @ 5:06 pm

There is another project of mine to practice TDD (Test-Driven Development) and C#, at:

It is an interpreter (not a compiler) of Go programming language, written in C#. It has a class library project, and a test project. Go is a typed language, so I cannot follow the path of build an expression tree, and evaluate it, as in RubySharp, PythonSharp and Mass. Instead, the interpreter should have many phases, as in ScalaSharp, to detect type inconsistencies, and use the declaration of unknown types at the parse process.

The AST is implemented:

The AST (Abstract Syntax Tree) nodes are in two groups:

– Command Nodes, where they should generate commands to be executed.

– Expression Nodes, that generates expressions to be evaluated. They have an associated type.

The commands declare variables with types. By now, I have all in place to start:

– Declare the types of some declarations of variables and functions
– Control that types are the right ones, ie, an integer variable should not be assigned to an string expression
– Start to emit commands and expression

As in other projects, I want to add access to native .NET types, libraries and objects. I should research how many features of Go I could implement in this approarch. An example: the implementation of Go structures, and their original semantic in C#. I could implement channels (years ago, I implemented channels in C# and AjSharp).

Stay tuned!

Angel “Java” Lopez

May 7, 2014

End Of Iteration 2014w18

Filed under: C Sharp, ClojSharp, Google, Iteration, JavaScript, NodeJs, Programming — ajlopez @ 5:07 pm

Previous Post
Next Post

Node Samples

I added a Picasa API search demo application


I added more basic functionality to my JavaScript scraper:

Now, each document element has a list of attributes. As a concrete use case, there are two console samples that generate structured JSON data from two  popular Argentinean news sites:


An interpreter of Go programming language written in C#, work in progress

Some lexer pieces in place, and the first parse expression method.


Artificial Neurons in JavaScript:

I removed events: no use case for them, yet. I added the construction of a multilayer network. Next step: automatic learning using back-propagation.


Clojure interpreter in C#:

I implemented metadata reader. Big surgical refactor: now adding metadata produces a new object (in previous naive implementation, the metadata was attached to the original object). Now, it follows Clojure expected semantics. But TDD saved my day!

Google Code Jam

I participated in Round 1B:

I solved only one problem, check

For another problem, Lottery, I had a not written solution with O(n,m). I thought that it was not good enough for processing large dataset. But, apparently, the large dataset had no hard problem. Some contestants solved the problem using O(n,m) solutions. It was an interesting problem, that deserve more thought. I didn’t understand the third problem (I confused tickets with flights)


There is a new empty Laravel PHP sample at Some new node parse methods in ScalaSharp I added first map, reduce implementations to I added more features to serialization in

I worked on three non-public projects, too.

More fun is coming.

Keep tuned!

Angel “Java” Lopez

April 15, 2014

End Of Iteration 2014w15

Previous Post
Next Post

Code Generation

I wrote new tasks, templates using my AjGenesis code generation tool. I create a simple:

to generate a Django web site, with admin page. The code generation creates the model, and admin feature allows you to edit the data, using Sqlite. It’s simple, but it is working. Next steps: create custom views, and a new project to generate Flask web site.

I added text area input fields to the project that generates Express/Node.js web site from a model. Next steps: client-side validation, better server code organization, some initial tests.

I want to integrate these tools in a online app, so I started to have a web site that generate codes from a model, defined at client side. You will select technology (Express, PHP, Sinatra, Django, Flask, …), the models (mainly, entities like: customer, supplier, department, employee, invoice… ), the database, the features (multiple pages, single page, angular? backbone? other?, REST API?, phonegap wrapper?), and voila. A zip will be generated with the generated solution. That is, code generation as a service. Maybe I could add an API to be externally consumed.


I added a Flask web site example, work in progress, to my Python Samples:

I will use as a basis for my AjGenesis code generation version for Flask web sites.

Actor Model in C#

I refactored my project

an Akka-like actor model implemented in C#. Now, I have a mailbox per actor, but the actor message process is executed consuming task from a queue, with n thread launched by the initial actor system. It was good to see such refactor working: all is in place, now. It is a proof that you don’t need to design everything before coding. If you follow TDD (Test-Driven Development) new ideas (or old ideas that have not implemented yet) can be added without much effort.

Erlang in C#

I started to add serialization of message to my project

As usual, I started simple, using TDD: write input and out channel, using tests, red to green, refactoring. Instead of consuming an external library for serialization, I wrote a simple code, towards my first use case of distributed application. When the use case will be in place, I could start to think about other implementation path.

Google Code Jam

Past Saturday, I participated in Google Code Jam, Qualification Round. My code, usually written following TDD:

The Minesweeper problem is the tricky one. I should add the description of the problems, copying it from the original site.


I added some code kata tests to my JavaScript samples I added metadata macro readind go my Clojure in C# I started to add type checking in my node tree for Scala in C# I added qualified name evaluation to my Rust interpreter in JavaScript I worked on two non-public projects, too.

More fun is coming.

Keep tuned!

Angel “Java” Lopez

December 28, 2013

TDD Rocks! (8) SharpBase in C#

Filed under: C Sharp, Google, Open Source Projects, ShapBase, Test-Driven Development, Video — ajlopez @ 6:24 pm

Previous Post
Previous Post with C#
Next Post

I recorded a new Google Hangout about using TDD (Test-Driven Development) workflow in Visual Studio 2010 and C#, writing my in-memory database project, SharpBase.

The video at:

This time I implemented a Column class. It was not need in previous tests. But now, I want to have the use case of having an autonumeric column, I added tests and functionality to cover that feature. I didn’t design all at advance. I designed the solution test by test, use case by use case. Maybe, in some point, I would apply a surgical refactor/redesign, but now, I have the test battery to support such change.

This is the last video about SharpBase. Since now, I will update directly the GitHub repo. You can check:

Maybe, I will record a new exercise, but in Spanish: an MVC application.

Keep tuned!

Angel “Java” Lopez

December 21, 2013

TDD Rocks! (7) OStore With JavaScript/Node.Js

Filed under: Google, JavaScript, NodeJs, Test-Driven Development, Video — ajlopez @ 6:35 pm

Previous Post
Previous Post with JavaScript/Node.js
Next Post

I published a new Google Hangout session, showing how I’m working on project OStore, using TDD Workflow:


In this sample, I’m not learning JavaScript, I already known it. I use the minimal code, in this case the module assert, built-in in Node.js. I sacrifice the isolation of test to gain in simplicity.

In this session, I implemented a find methods a la query by example, like in MongoDb. Now, it is returning an array of JavaScript objects. I could refactor it to return a cursor. Then, the cursor could retrieve millions of records, without using an array as memory.

But you know my workflow: baby steps, make it works, then, make it right, make i fast. In other project I’m reproducing MongoDB behavior directrly in in-process JavaScript.

Keep tuned!

Angel “Java” Lopez

December 1, 2013

TDD Rocks! (6) Playing with Ruby

Filed under: Google, Open Source Projects, Ruby, Test-Driven Development, Video — ajlopez @ 3:34 pm

Previous Post
Previous Post with Ruby

I’m still learning Ruby. To practice the language, I’m writing a Tokenizer using my TDD (Test-Driven Development) workflow.

A new video at

I did two redesigns:

– To provide the text to tokenize in the tokenizer constructor

– Rename getTokens methods to a more "rubyist” name get_tokens

After those redesigns, I dived into a big implementation refactor. Maybe, I had to avoid that work, or split it in more manageable pieces. At the end, I survived, and the tokenizer implementation is started to emerge. You can check another of my implementations, in JavaScript/NodeJs:

The Ruby version is at:

Keep tuned!

Angel “Java” Lopez

November 30, 2013

TDD Rocks! (5) SharpBase in C#

Filed under: C Sharp, Google, Open Source Projects, ShapBase, Test-Driven Development, Video — ajlopez @ 2:01 pm

Previous Post
Next Post
Next Post with C#

I’m coding SharpBase, documenting my TDD workflow using Google Hangouts. The new video at:

I implemented how to insert a row, given its values the method returns the new row. In this first test I only tested that the row was built. In the second tests I managed to implement the store of rows in a table. There is no interaction between rows and columns, yet. I could add tests for:

– Insert has less values than defined columns

– Insert has more values than defined columns

– Defined types in columns

– Autonumeric column

– Primary Key column

– Retrieve by primary key value

– Retrieve with given values (like MongoDB find), that is, query by example

– Query with operators

Those are things to write in the upcoming tests. I could record one or more videos, and then, I would switch to direct code in GitHub. The videos are for explaining the workflow, but after a few example I guess the process is clear. The idea is to implement using “baby steps”, and new tests/examples. TDD is like to play a videogame. Each new test/example is a challenge, and when we code to pass the test in green, we reach a new level in the game.

Keep tuned!

Angel “Java” Lopez

November 29, 2013

TDD Rocks! (4) SharpBase In C#

Filed under: C Sharp, Google, Open Source Projects, Test-Driven Development, Video — ajlopez @ 2:09 pm

Previous Post
Next Post

This is the second part in my series of using TDD in the writing of SharpBase, simple in-memory database, in C#. The new video:

As in the previous video, I’m adding tests, advancing by “baby steps”. The code is at:

I added tests over tables, testing how to add columns using their names. The columns still have no type or other features. In the next installment, I will add the insertion of a row to a table.

I hope you can understand my spoken Anglish 😉

Keep tuned!

Angel “Java” Lopez

November 27, 2013

TDD Rocks! (3) SharpBase in C#

Filed under: C Sharp, Google, Open Source Projects, Test-Driven Development, Video — ajlopez @ 4:46 pm

Previous Post
Next Post

You already know, I like to code models in memory. Some time ago (months? years?) I started a project to build an in-memory relational database, using C#. To practice TDD, I decided to start it again, from scratch, documenting the first steps of the process in videos. After showing my workflow, the work will continue with commits in my GitHub Account. The first video:

The code is at:

Notice I didn’t make “big decisions” before the coding. I still don’t implement what is a Row, no idea yet for index and other stuff, like column types. I only coded the first use cases, with a simple API: create a database with name, check if it exists, etc…

I used the test library that comes with Visual Studio (Professional, Ultimate), already integrated in the IDE. Maybe, I could use NUnit or other solutions, but I’m proficient with this approach.

The important thing is not the tool: it is the workflow. Write a test with a new example, compile it, then code it to get green result, refactor, write a new example/test again, and so on. Don’t be afraid of refactoring (internal changes in implementation) or redesign (change in exposed API). And there are also test code refactoring. In general, in the refactoring we can add the patterns we know, cut repeated code, etc. In my case, I push for not have a lot of upfront design. That is the way I use in my personal and professional projects.

I hope you can understand spoken Anglish 😉 (Angel’s English)

Keep tuned!

Angel “Java” Lopez

November 11, 2013

TDD Rocks! (2) OStore With JavaScript/Node.js

Filed under: Google, JavaScript, Test-Driven Development, Video — ajlopez @ 7:14 pm

Previous Post
Next Post
Next Post with JavaScript/Node.js

I recorded this Google Hangout on air. It was automatically published on my Youtube account:

An in-memory object store. This time, the programming language is JavaScript, using Node.js. As usual, I’m speaking Anglish (Angel’s English).

I showed my usual workflow of development, starting with Node.js require(‘assert’). Even when the under-development software should run in browser, I wrote it from console, using Node.js and a minimal library. As an example, see the commits of that I use from the browser at

In this first code, I didn’t think on callbacks. Maybe, in future requirements, I will refactor/redesign the code to support them. In that case, I could use MongoDb as an store. But I prefer to start simple and do “baby steps” instead of designing a lot at beginning.

When we follow the TDD workflow, software development is like a video-game: we are going from one level to the next, solving puzzles (making a test running in green). And then, applying refactor to minimize technical debt. The  software grows organically, where each line of production code can be traced back to a test.

There is a second video.

Keep tuned!

Angel “Java” Lopez

Older Posts »

Create a free website or blog at