January 31, 2012

Exercise: Sieve of Eratosthenes

After reading an interesting blog post from Robert Martin I started writing this nice algorithm in Ruby (I'm still learning it).

As I'm a refactoring freak, here's the first version:

Nasty right? Then the cleaned up release:

January 28, 2012

El fin de una epoca

Un poco nostálgico para estos dias, pero me parece correcto definir este día como importante con respecto a mi vida. A pesar de que no soy una persona religiosa ni teológica, me he visto afectado por esta noticia:

Ciertamente era una persona apreciada por mucha gente (no por mi persona) y sus palabras influenciaron a miles de personas alrededor del mundo. No es mi intención hacer apología de su trabajo, solamente quiero recalcar que su vida afectó la mía. Que su trabajo de alguna forma me hizo ser lo que hoy soy.

A pesar de que su programa me aborrecía y de que sus mensajes me parecían inútiles, marcaron una etapa imborrable de mi crecimiento.

Junto con el se van muchas otras personas que afectaron mi vida de alguna forma y de seguro la de muchos mas.

January 24, 2012

Supporting short lived objects

While working on some projects with different environments and behaviors, I started liking the notion of short-lived objects. Besides, I read a lot in several threads from StackOverflow > http://stackoverflow.com/questions/631919/short-lived-objects.


I like this kind of objects because they are easy to control, debug, update, delete. The notion of having an long living object is state, but to keep that state among several instances and requests can be a real hell if you don't control it properly.

And as you may guess, concurrency is one of the things I don't like to deal with, I prefer to leave it to a framework or third-party concurrency manager.

Benefits:
  • Easy to control
  • Easy to code
  • Easy to test
  • Challenges your design skills
  • Avoids singleton all over the place
  • It enhances performance 
Drawbacks:
  • If you don't control them, you can have an big object pool
  • You have to take care of references and garbage collection
  • If your design is bad, your objects will be bad as well.

January 19, 2012

Fossil SCM

A few months ago I listened to FLOSS Weekly's episode about SQLite, and I wondered how this wonderful project was being managed.

After checking for a while, I found that D. Richard Hipp has developed his own distributed SCM based on the very reliable SQLite.


In a comparison with Git and Hg (which I have used), it is more than a SCM, it is a whole project-development space. Some of its features include:
  • Bug Tracking And Wiki, really cool.
  • Web Interface, incredibly simple.
  • Autosync, still wondering what its benefits are.
  • Self-Contained, yep, everything in one binary file.
  • Simple Networking.

As a developer of some internal projects, it's really hard to keep track of my bugs an issues, and the environment required for it costs too much. But this amazing project does it for me!

Its use is very similar to any distributed SCM and the installation/configuration is barely present. I totally encourage you to try it.

Semantics and programming

After using the Play framework for a while, and reading several good articles, I started using some of the concepts that have been around the cloud for some time.

One of them took my attention, the one claiming:
"Never use strings in Java"

Initially I found this really stupid, how can you program without strings?

But after applying the concept for some months, it has showed me how wrong I was. Once you start coding with Objects, you are giving your operations a semantic meaning. This means that you can say by checking an operation identifier what it really does.

It also simplifies the API definition, because the object talk by themselves. You will not be able to pass a null string as a parameter, instead you will create a class wrapping it, then the wrapper class is in charge of checking if the data you are using is valid.

As I'm still digging into it, more posts will be written about the topic. Just as a suggestion, please take a look at it.

Resources: