Friday, June 24, 2011

Clean code thrilled

This afternoon I received a parcel from Amazon with the two books I had ordered:
I'm thrilled, I've just read Clean Code's first chapter and I'm already loving it. 
I'm looking forward to read the rest of the book.

Sunday, June 19, 2011

Revisiting Introduction to Algorithms

I'd like to add some information to my recent post about MIT Introduction to Algorithms course.

Peteris Krumins followed this course online some time ago and posted his personal notes for every lecture in his interesting blog: Good coders code, great reuse.

Learning TDD

TDD stands for Test-driven development and quoting the Wikipedia definition is
"a software development process that relies on the repetition of a very short development cycle: first the developer writes a failing automated test case that defines a desired improvement or new function, then produces code to pass that test and finally refactors the new code to acceptable standards".
I've been hearing a lot about it since I started programming again. That aroused my curiosity and I'd like to learn how to use it.

These are the resources that I plan to use:

Thursday, June 16, 2011

Software Carpentry version 4

Some time ago I posted about Software Carpentry.

Software carpentry is a wonderful initiative to teach scientists and engineers the concepts, skills, and tools that will help them use and build software more productively.

I recently revisited the Software Carpentry site, and they have released the version 4.

These are the lectures in this last version:

All the lectures are freely available under a Creative Commons license.

Learning Design Patterns with PatternCraft

John Lindquist's PatternCraft is a collection of videos that explain design patterns using illustrative examples.

We're using them to help introducing design patterns in our team.

Monday, June 13, 2011

Introduction to Algorithms

I've started to watch the videolectures from the course:
MIT 6.046J/18.410J Introduction to Algorithms (SMA 5503), Fall 2005.

You can find them on youtube or download them from the course site in the MIT OCW.

I hope to learn a bit about data structures, algorithms and complexity.

Tuesday, June 7, 2011


It's just been released a new and improved version of the Creative Common Library I mentioned in an earlier post: OpenLibra
Acaba de salir una nueva versión mejorada de la Biblioteca Creative Common que mencioné en un post reciente: OpenLibra

How to install JsonCpp in Ubuntu and use it in Eclipse CDT

You need to follow these instructions (I slightly modified this installing guide for Mac OS X) to install JsonCpp in Ubuntu and use it from Eclipse:

1. Download JsonCpp from here.

2. Create a new folder decompress and extract JsonCpp there:
$ mkdir /home/youruser/JsonCpp
$ tar xzf /home/youruser/JsonCpp/jsoncpp-src-0.5.0.tar.gz

3. Donwload the SCONS software construction tool from here and decompress and extract it in the jsoncpp-src-0.5.0 folder.
$ tar xzf /home/youruser/JsonCpp/jsoncpp-src-0.5.0/scons-local-1.3.0.tar.gz

4. Copy the contents of scons-local-1.3.0 inside jsoncpp-src-0.5.0

5. Go to jsoncpp-src-0.5.0 and build JsonCpp using SCONS:
$ cd /home/youruser/JsonCpp/jsoncpp-src-0.5.0
$ python platform=linux-gcc check

5. Install the JsonCpp library and header files:
$ sudo cp /home/youruser/JsonCpp/jsoncpp-src-0.5.0/libs/linux-gcc-4.4.5/ /usr/lib
$ sudo mkdir /usr/include/jsoncpp
$ sudo cp /home/youruser/JsonCpp/jsoncpp-src-0.5.0/include/json/* /usr/include/jsoncpp/

6. Finally open your Eclipse project, go to Project -> Properties -> C/C++ Build -> Settings -> GCC C++ Linker -> libraries and add json_linux-gcc-4.4.5_libmt.

That's all you need to start using JsonCpp in Eclipse

Monday, June 6, 2011

Using JsonCpp to parse JSON in C++

We are using JSON (JavaScript Object Notation) to write the configuration files for our simulations.

JSON is a lightweight data-interchange format. The good thing is that JSON is easy for humans to read and write and that you can find good C++ libraries that parse and write it.

We're using one of them: JsonCpp.

There were several other C++ libraries listed in the JSON project website, but JsonCpp's documentation convinced me to use it.

I installed JsonCpp as a shared library (I'll soon post here how to do it in Linux and MacOs) and wrote a tiny example to test it:

#include <cstdio>
#include <cstring>

// This is the JSON header
#include "jsoncpp/json.h"

using namespace std;

int main(int argc, char **argv)
 string json_example = "{\"array\": \
                            [\"item1\", \
                            \"item2\"], \
                            \"not an array\": \
                            \"asdf\" \

 // Let's parse it  
 Json::Value root;
 Json::Reader reader;
 bool parsedSuccess = reader.parse(json_example, 
 if(not parsedSuccess)
   // Report failures and their locations 
   // in the document.
   cout<<"Failed to parse JSON"<<endl 
   return 1;
 // Let's extract the array contained 
 // in the root object
 const Json::Value array = root["array"];
 // Iterate over sequence elements and 
 // print its values
 for(unsigned int index=0; index<array.size(); 
   cout<<"Element " 
       <<" in array: "
 // Lets extract the not array element 
 // contained in the root object and 
 // print its value
 const Json::Value notAnArray = 
               root["not an array"];
 if(not notAnArray.isNull())
   cout<<"Not an array: "
 // If we want to print JSON is as easy as doing:
 cout<<"Json Example pretty print: "
 return 0;

And this is the output:
$ g++ -o test_json test_json.cpp -ljson_linux-gcc-4.4.5_libmt
$ ./test_json 
Element 0 in array: item1
Element 1 in array: item2
Not an array: "asdf"

Json Example pretty print: 
   "array" : [ "item1", "item2" ],
   "not an array" : "asdf"

There are many other useful methods in JsonCpp's API.

Using a library like JsonCpp, we avoided all the parsing and could focus only on how to use the configuration data. This saved us a lot of time.

Interesting C++ blog

I'm following this interesting C++ blog:
Advanced C++ with examples 
My favourite posts so far have  been a series about design patterns and their implementation in C++.

Saturday, June 4, 2011

My Agile Education

I love Angela's blog My Agile Education.

I think the best description for this blog is Angela's one:
"As far as I know, no one offers a university degree in Agile software development. Since I'm an unschooler by nature, that's ok with me. I'm learning to write software, understand Agile principles, and connect those things to business. This website is for me to learn, and to process and record some of that learning.
And maybe you can do some teaching and learning, too."
The structure of the blog is the following:
  1. She asks a question, expressing her doubts about some concept or technique.
  2. A lot of people from the Agile community answer her, and this way, a profound and interesting debate is started.
I found these debates really informative and worth to read.

There are two other things about this blog that I consider specially interesting:
  • How career switching at a mature age is a more usual phenomenon in USA than here in Spain. I think that it's a great thing and that people switching careers can give a lot to their new fields. I wonder if this type of blog would be so successful here.
  • The amount of people who are able to go on as developers in their forties, fifties and sixties without having to switch to some management job.
To conclude, I'd like to thank Angela for letting us follow her Agile education and giving us an opportunity to learn with her and her community of mentors.

Wednesday, June 1, 2011

Biblioteca Creative Commons | Creative Commons Library

Hace poco descubrí una Biblioteca Creative Commons que contiene libros de informática muy interesantes. Algunos están escritos en inglés y otros en español.

Además el blog de Etnassoft tampoco tiene desperdicio, sobre todo si te interesa JavaScript y jQuery.
Recently I've found a Creative Commons Library which has lots of very good computer science books. Some books are written in Spanish and some in English,

Besides Etnasoft's blog (in Spanish) is also really interesting, specially if you're interested in JavaScript and jQuery.