Angel \”Java\” Lopez on Blog

April 20, 2015

Liqueed Project (5)

Filed under: Express, Liqueed, NodeJs, Test-Driven Development — ajlopez @ 5:38 pm

Previous Post

Let review two more tests from test/personapi.js. The second test is actually:

exports['get persons'] = function (test) {
    var request = {};
    var response = {
        send: function (model) {
    controller.list(request, response);

After building the domain model in memory (the first test taks), now we can test a controller action method, named getPersons. It requires to receive two arguments, request and response object. In the above code, two stubs were built and used. The response object has a send function that  it should be invoked to pass the tests. It receives the model to send to the client, as a JavaScript object (in the real environment, the object is serialized to JSON via Express response send method).

The third test is:

exports['get first person'] = function (test) {
    var request = {
        params: {
            id: persons[0].id.toString()

    var response = {
        send: function (model) {
            test.equal(, persons[0].id);
            test.equal(, persons[0].name);
    controller.get(request, response);

The action needs something from request object, an aditional argument having the person primary key to be retrieved. There is a send method in request object, to test the result.

The tests are not using HTTP nor GET method. They are directly testing the controller code. Indeed, that code was written AFTER the tests, and its first execution was from test launch, without the need of launch a web server.

Next posts: other tests for API methods, sending objects, and tests for MVC controllers

Stay tuned!

Angel “Java” Lopez

April 16, 2015

Computer History: Links and Resources (8)

Filed under: Computer History, Links — ajlopez @ 6:18 pm

Previous Post

Symbian – a post mortem – Google Docs

Generation Gap

Computer History Museum | @CHM : The APL Programming Language Source Code

An Interview with Brian Kernighan on C and The C Programming Language | | InformIT

La historia de Javascript | fernetjs

Simon Peyton Jones – Haskell is useless – YouTube

The TTY demystified

HTML5 Web Storage – Cookies Are So 1994! | New Relic blog

How Ruby Borrowed a Decades Old Idea From Lisp – Pat Shaughnessy

10 programadores que cambiaron la historia – Gen 2.0 ADN Digital

Monitors: An Operating System Structuring Concept

The Alan Turing Legacy | Instituto de Ciencias Matemáticas

2048 bits on a CRT

Tom Kilburn

50th Anniversary of the Manchester Baby computer

Herbert Kroemer – Wikipedia, the free encyclopedia

The History of the Floppy Disk – Input Output

What Killed the Linux Desktop – Miguel de Icaza

BYTE Vol 06-08 1981-08 Smalltalk.pdf – Google Docs

Agosto 2012: 25 años de la primera Revista Telenews | Facebook

Coding Horror: I Was a Teenage Hacker

Russell A. Kirsch – Wikipedia, the free encyclopedia

Russell A. Kirsch : SEAC and the Start of Image Processing at the National Bureau of Standards – National Institute of Standards and Technology Virtual Museum

An Unexpected Ass Kicking | Blog Of Impossible Things

My Links

Stay tuned!

Angel “Java” Lopez

April 15, 2015

Liqueed Project (4)

Filed under: Express, JavaScript, Liqueed, NodeJs, Test-Driven Development — ajlopez @ 8:42 pm

Previous Post
Next Post

The project:

was built using TDD (Test-Driven Development) worflow. In the previous post I showed a logic service example, implemented using tests. Today, I want to show that the MVC controllers was also coded using TDD. The controllers are JavaScript modules that expose functions as actions to be routed by Express. The actions receive and return JSON objects. They are the basis for the exposed API, to be consumed by the clients (actually, only one client, a simple single page application). For example, controllers\personapi.js starts declaring:

'use strict';

var service = require('../services/person');

It consumes the person service module.

There are associated test at test\personapi.js, its initial imports:

'use strict';

var controller = require('../controllers/personapi');

var loaddata = require('../utils/loaddata');
var db = require('../utils/db');
var async = require('simpleasync');

In the previous post, I mentioned that the test granularity I prefer for JavaScript is the module, not the function. So, all the tests in the module are execute, in declaration order. The first test is in charge of inicialization the domain model:

var persons;

exports['clear and load data'] = function (test) {
    var personService = require('../services/person');

    .then(function (data, next) { db.clear(next); })
    .then(function (data, next) { loaddata(next); })
    .then(function (data, next) { personService.getPersons(next); })
    .then(function (data, next) {
        persons = data;

The new thing to understand is the use of the module simpleasync, pointed by the async variable. I wrote the module to chain  functions. Each function receives two arguments: data, the success result of the previous executed function in chain, or the initial value triggered in the run chain function. And next, a callback to be invoked by the function, to execute the rest of the chain. The callback receives two arguments: err and data. So it can be used as the callback of other functions. If err is not null, the next functions in chain is not executed and the function defined in the chain fail method is run (this option is not used in the above code). In the above example  personService.getPersons(next) invokes the retrieve of the person list, using next as callback. The next chained function receives the person list in the data argument, and then, it saves it in a module variable, ready to be used by the rest of the tests.

It is not using a database. It using an in-memory domain model. That is the default “persistence”, and it is used in many of the defined tests. The initial domain model is loaded from testdata.json using the loaddata function:

    "projects": [
            "name": "FaceHub",
            "periods": [
                    "name": "January 2014", 
                    "date": "2014-01-31", 
                    "amount": 100,
                    "assignments": [
                        { "from": "Alice", 
                            "to": "Bob", 
                            "amount": 50, 
                            "note": "Arrive earlier" },
                        { "from": "Alice", 
                            "to": "Charlie", 
                            "amount": 50 , 
                            "note": "Arrive earlier" },
                        { "from": "Bob", 
                            "to": "Alice", 
                            "amount": 60 , 
                            "note": "Arrive earlier" },
                        { "from": "Bob", 
                            "to": "Charlie", 
                            "amount": 40 , 
                            "note": "Arrive earlier" },
                        { "from": "Charlie", 
                            "to": "Alice", 
                            "amount": 35 , 
                            "note": "Arrive earlier" },
                        { "from": "Charlie", 
                            "to": "Bob", 
                            "amount": 65 , 
                            "note": "Arrive earlier" }
                { "name": "February 2014", 
                    "date": "2014-02-28", 
                    "amount": 100 }
            "team": [ "Alice", "Bob", "Charlie" ],

The module personapi.js exports some functions to be used as actions:

module.exports = {
    list: list,
    get: get,
    getProjects: getProjects,
    loginPerson: loginPerson,
    updatePassword: updatePassword

Topics for the next posts: more API tests, routing of actions, persistence, etc.

Stay tuned!

Angel “Java” Lopez

April 8, 2015

New Month’s Resolutions: April 2015

Filed under: C Sharp, JavaScript, NodeJs, Open Source Projects — ajlopez @ 8:33 pm

It’s the time for review my March’s resolutions and write the new ones:

– Improve ClojSharp [complete] see repo
– Improve ScalaSharp [complete] see repo
– Write posts about JavaScript and Artificial Intelligence [pending]
– First published version of ClojJS [partial] see repo
– Add npm modules support to ClojJS [pending]
– First published version of BScript [partial] see repo
– Improve Chip8 emulator [pending]
– Give a full-day course on NodeJS [complete]

Additionally, I worked on:

– Update SimpleAsync, removing setImmediate [complete] see repo
– Update SimpleBus to use SimpleUnit [complete] see repo
– Improve AcquarellaJS detecting comments [complete] see repo
– Improve SimpleArgs using flags [complete] see repo
– Improve DValues [complete] see repo
– Update Complexo tests to use SimpleUnit [complete] see repo
– Project Liqueed [complete] see repo

My resolutions for the new month:

– Write posts about JavaScript and Artificial Intelligence
– Improve ClojJS
– Add npm modules support to ClojJS
– Improve Chip8 emulator
– Improve BScript

Stay tuned!

Angel “Java” Lopez

April 6, 2015

Material Design, Links and Resources (1)

Filed under: Android, Links, Material Design, Mobile, We, Web Development — ajlopez @ 6:26 pm

Google Design


Material Design

Material UI – Material Design React Components

7 Material Design Web UI Frameworks

Material design with Polymer – Polymer

Paper Elements Sampler

Quiz App

Welcome – Polymer

Documentation – Materialize

My Links

Stay tuned!

Angel “Java” Lopez

April 1, 2015

Polymer: Links and Resources (1)

Filed under: Links, Polymer, Web Development — ajlopez @ 8:09 pm

Browser Compatibility – Polymer

Anyone have any opinion on React vs Polymer? It’s something i’ve been strugglin… | Hacker News

Riot vs React vs Polymer

Component Interop With React And Custom Elements

html – Is it possible to use Polymer inside of React? – Stack Overflow

javascript – Pros and Cons of Facebook’s React vs. Web Components (Polymer) – Programmers Stack Exchange

Paper Elements Sampler

Quiz App


JavaScript Application Architecture On The Road To 2015 — Medium

Join the Web Components revolution with Polymer

Google I/O 2014 – Polymer and the Web Components revolution – YouTube

Google I/O 2014 – Unlock the next era of UI development with Polymer – YouTube

Google I/O 2014 – Polymer and Web Components change everything you know about Web development – YouTube

Welcome – Polymer

Flexible, high-strength polymer aerogels deliver "super-insulation" properties

My Links

Stay tuned!

Angel “Java” Lopez

March 27, 2015

Deep Learning: Links, News And Resources (3)

Filed under: Artificial Intelligence, Deep Learning, Links — ajlopez @ 10:43 am

Previous Post

Deep Learning Portal | NVIDIA Developer

Unsupervised Feature Learning and Deep Learning Tutorial


Facebook’s latest deep learning tech can quickly interpret text and video | VentureBeat | Big Data | by Jordan Novet

Deep Learning, NLP, and Representations – colah’s blog

Neural networks and deep learning

Intel’s Deep Learning Play: Next-Gen Xeon Phi Could Challenge NVIDIA GPUs – Forbes

Deep Learning Tutorials — DeepLearning 0.1 documentation

Deep Learning Relies on Renormalization, Physicists Find | Quanta Magazine

My Links

Stay tuned!

Angel “Java” Lopez

March 25, 2015

Computer History: Links And Resources (7)

Filed under: Computer History, Links — ajlopez @ 5:30 pm

Previous Post
Next Post

(16) Remy Sharp – Google+ – Where polyfill came from / on coining the term It was when…

The History of HTML5 Mashable The History of HTML5 | The top source for social and digital news

Larry Page’s Google Business Card, 1998 | Retronaut

Keynote: How the 10 Key Lessons from Java and C++History Inform the Cloud

Steve Wozniak’s Reaction To Surface Tablet: ‘Steve Jobs Was Reincarnated At Microsoft’

The Evolution of the Web

The Good Soldier LMeyerov: Socio-PLT: Principles for Programming Language Adoption

command center: Less is exponentially more

Watch Steve Wozniak Talk About the Good Old Times at Apple—Because He’s Just Awesome

introduction to smalltalk

Computer History Museum | Exhibits | This Day in History: June 15

Classical Computer Science Texts

Kim Scheinberg’s answer to Apple Inc.: How does Apple keep secrets so well? – Quora

Tektronix 4404 Smalltalk Demo – YouTube

InfoQ: Interview with Simon Baker, Author of No Bull

What’s the oldest computer you’ve worked on? – Giant Bomb

Quotes about programming languages

Make mainframes, not war: how Mad Men sold computers in the 1960s and 1970s | Ars Technica

maxwell’s equations of software — wingolog

My Links

Stay tuned!

Angel “Java” Lopez

March 22, 2015

Computer History: Links And Resources (6)

Filed under: Computer History, Links — ajlopez @ 3:37 pm

Previous Post
Next Post

InfoQ: The JavaScript World Domination Plan at 16 Years

Unlimited Novelty: Introducing DCell: actor-based distributed objects for Ruby

CiteSeerX — The Smalltalk-80 Implementation at Hewlett-Packard, in Smalltalk-80: bits of history, words of advice

Design Principles Behind Smalltalk

Alan Kay – Wikipedia, the free encyclopedia

CiteSeerX — Some Philosophical Problems from the Standpoint of Artificial Intelligence

tele-TASK Podcast: 50th Anniversary of Objects?

What blocks Ruby, Python to get Javascript V8 speed? – Stack Overflow

The coolest merge EVER!

From the comments:Ten days to implement the [Javascript] lexer, parser, bytecode… | Hacker News

Lisp as the Maxwell’s equations of software | DDI

Cx9 – Cx9

Coding Horror: Preserving The Internet… and Everything Else

When computers were sexy: Hilarious vintage ads from the early days of the PC | Mail Online

Mark Pilgrim (software developer) – Wikipedia, the free encyclopedia

Default to open: The story of open source and Red Hat!

Love Hotels and Unicode | ReignDesign

C# Language Features, From C# 2.0 to 4.0 – CodeProject®

The First 30 Tweets Ever

First 30 Tweets (first30tweets) on Twitter!/First30Tweets

Twitter / @jack: just setting up my twttr …!/jack/status/20

The History of Programming Languages [Infographic]

Low-tech Magazine: Truckloads of hard disks

How Emacs changed my life

My Links

Angel “Java” Lopez

March 20, 2015

Computer History: Links And Resources (5)

Filed under: Computer History, Links — ajlopez @ 4:48 pm

Previous Post
Next Post

Colossus: Creating a Giant – YouTube

Cómo se creó la primera computadora electrónica del mundo –

¿Cómo eran las redes sociales en sus inicios?

Smalltalk? A quién le puede importar by Leandro Caniglia on Prezi

(20) Fotos del muro

Yutaka Hara – Ruby’s past, present, and future on Vimeo

big-comp-tree.gif (1280×742)

Faith, Evolution, and Programming Languages

The Network with Smarts

Multics Emacs History/Design/Implementation

Multics Emacs – Wikipedia, the free encyclopedia

MIT Lecturer Defends His Standing As Email Inventor – Slashdot

Redesigning the Windows Logo

The Universe of Discourse : It came from… the HOLD SPACE

Code & Beyond: Video: Bjarne Stroustrup presenta el estilo de C++11 en Going Native 2012

Apple founder Steve Jobs ‘took drugs and abandoned his family – Telegraph

Elegant Code » Solving the upload progress bar problem–The History of Node.js

websites from hell

The Pragmatic Bookshelf | PragPub 2012-02 | When Did That Happen?

The Pragmatic Bookshelf | PragPub 2011-11 | When Did That Happen?

The Pragmatic Bookshelf | PragPub 2011-12 | When Did That Happen?

1991 Summer CES – YouTube

My Links

Older Posts »

The Shocking Blue Green Theme. Blog at


Get every new post delivered to your Inbox.

Join 69 other followers