Why did this year has passed so swiftly? My 2014 Retrospective.

Today an original post. Maybe I’m the only one doing this, I know. 2014 is close to finish and I want to review how it went the year. Let’s start.

The bad parts:

  • My book about SOLID principles (in Spanish) isn’t released yet. It’s almost finished. It only needs a few reviews, but because one thing or another it looks like it isn’t be released this year. Lesson learned: Those kind of side projects must have a release date. If they haven’t, another side projects can grab our attention and they can be frozen.
  • No new languages learned this year. There was a good chance with Swift. A new language, but it didn’t attract my attention. Erlang books are still in my desk and also my aim to improve my Java skills didn’t success. I found nothing where apply my Java learning.

The good parts:

  • Finally I can say JavaScript is a first class language within my personal software stack. Various projects with JS this year and I feel very comfortable writing JavaScript code. That’s also the year of Angular.js (for me and probably a lot of people).
  • This year has been the year of mobile development for me. I’ve been involved with several projects using Cordova/Phonegap framework. I the beginning to install Cordova environment, compile, deploy the application into the device was something “heroic” but now it turns into trivial operations. I still remember my beginning with jQuery Mobile. Horrible. Then I started using Angular.js and Topcoat. Much better, but still problems when switching between Android and IOs. Finally I re-discover Ionic framework. Incredible project. Hybrid applications with angular.js with very complete toolkit. This year has been crowed by push notifications, camera plugins, barcode scanners, token based authorisations, Websockets and things like that. Now hybrid applications with Phonegap/Cordova live in my comfort zone along with Silex, Angular, PHP… (that’s means I need to find other places outside it)
  • The last part of the year I’ve been working a lot with automation tools: Bower and Grunt mainly. I also started to work with JavaScript testing with Karma and Jasmine
  • This year I’ve been a proud speaker at DeSymfony Day in Barcelona. On incredible weekend. Meeting with colleagues, speaker dinner, great conversations, and tourism in a great city. Definitely the most beautiful room for a conference that I ever been
  • Katayunos The coding dojo where we play with TDD and Pair Programming is still alive. Maybe not as continuous as I’d like, but we still meet together 20-25 people one Saturday morning to improve our programming skill, from time to time
  • My personal blog is still alive too. It’s close to be 5 years old (OK, technically speaking 6, but first year it wasn’t a serious one). More than 20k views per month and sometimes close to 30k (Hey, thank you for reading!)

And that’s all. It was a good year. Hopefully it will be worse than 2015 🙂

See you!


My development tips

Another unsorted list of ideas this time about coding tips.

code = mass

The source code isn’t an abstract element. OK it’s not as touchable as apples or bricks but it’s somehow under physical laws too. You must write as less code as you can to meet your requirements. Big code means big mass and if you have a big mass you will need more energy to change whatever you need. I can stop a car toy with my hand but I need something more to stop a real train with the same speed. Less code means less failure points and it’s easier to manage. Some people claim proudly they have written a library with thousands of code lines. Nobody pay us for writing lines of code. They pay us for the solutions. The lines of code that we write is our problem. So be as minimalistic as you can. The problem is that writing less code is more complicated than write more. We need to think more to write less code.

DRY (Don’t repeat yourself)

Original, isn’t it?.  Copy & paste is evil. Never use it in your projects. Spread the same code among different files means that you will need to remember where are those pieces of code when a bug appear (they appear, believe me). There’re a lot of techniques to avoid copy & paste source code. Use them. There isn’t any excuse to it.

Coding standards

The source code is one of your deliverables as developer. You must care about it. Adopt a coding standard. Chose one and use it. If you work with a team take this decision with your team, but don’t try to create one standard by your own. It’s a big job. If you use one of the existing coding standards (let’s say Zend Framework’s one) you will find tools to validate your code against it and the most common IDEs and text editors will be able to use it too. In other way if you create a new one you will need to develop those plug-ins and tools and even you will need to document it if you want to show it to another developer. To many work that nobody will pay for it only because you dismiss an existing one.

Revision control.

Mandatory. Even for small and personal projects. I like Mercurial. it’s easy to use and easy to install. Anyway there are others similar like git or bazzar. Or if you are old school, CVS and Subversion. When I start a project, after create an empty folder with the name of the project I always execute “hg init” to create my repository. Commit you code often. Every time you make something important commit your work. Don’t wait until your project is finished. Revision control is a great backup system too. When something wrong happens like accidentally delete of a folder or something similar you can recover it easily without any problem. Also with a simple hg push (or similar command with another software different from mercurial) you will save your project into another place. If you don’t know to use any revision control system aside time for it. Believe me. You will not need too many time to learn how to use it. At least a basic usage.

Text editor

Is your main tool as a developer. It’s like the hammer for a carpenter. You must train yourself in the use of it. A good skill in the use of a text editor or IDE will give great benefits. If you think in term of ROI, the investment you use in your IDE will return sooner or later. Some of them are not trivial. For example Eclipse needs time to learn how to configure it. You must skill yourself into the IDE if you don’t want to lose your time developing (remember time = money). I’ve seen people programming PHP with notepad. You need at least syntax highlight, syntax error detection, auto-completion, auto-completion with code introspection and debugging. Don’t waste your time.

Digressing about working with old code, refactoring and scope creep.

Maybe there’re people who write code without bugs and never need to change one line of their source code. That’s not me. I try to improve my coding skill for the years. That means sometimes I need to face against my old code and if need to rewrite it probably I will do in a different way. I always feel the desire to refactor it. Refactor code is a good thing but is not always viable.Let’s show an example. Nowadays I’ve embraced Zend coding standard. For instance one not camelized variable creeps me out. But in my early days as a PHP developer (almost ten years ago) I didn’t take care about any coding standards. If code worked, it was OK. Now I realized that’s not enough. Code must work. Indeed!. But it must be ready to be changed, adapted to new needs and meet new requirements, and another developer must be able to understand it. Last days before holidays I’ve been working adapting a project to PHP5.3. It’s not a hard job. Some functions have disappeared, now we only have one kind of regular expressions and a couple of things more. I need to check a lot of lines of code. Sometimes I blush myself when I see the code I wrote five or even eight years ago. I want to change a lot of things. Refactor again and again but I must remember that’s not in the scope of the project. The objective of the project is clear: The application must work in a server with PHP5.3. If I start to refactor code the project deviates from project’s main scope. That’s a clear scope creep’s signal.

According with theory the main signals of scope creep are:

  • More work has been done than required
  • Product features don’t match the specifications.

Scope creep one of the most important problems in real projects. It’s very difficult to explain to someone that you will delay your project because you have decided to refactor some pieces of code (code that worked). That’s means your project will be delayed because you’ve decided to improve something that nobody ask for it. If you are on schedule maybe you can assume some refactor but think this kind of work is only viable if the triple constraint model (aka Scope + Budget + Schedule) keep unaltered. You must assess if those unsolicited changes have any impact in the project. Projects must end at some point. At some point you will need to submit the project’s deliverables, put your feet up and relax. But the temptation is big. I know.

Soy rico

Lunes 7:00. Suena el despertador. Normalmente cuando suena el despertador es el peor momento del dĂ­a. Hoy encima me ha sentado especialmente mal (lunes, vacaciones recientes, …). Llego a la oficina, miro el correo y me encuentro con esto:


I am Kun Chun, a legal practitioner. A defunct client of mine, that bears the same last name as yours, passed away due a heart-related condition on January 12th 2005. His heart condition was as a result of the death of all the members of his kinsfolk in the tsunami disaster on the 26th December 2004 in Sumatra Indonesia.

I am contacting you to seek your consent to present you as a successor to my late client, who has a deposit of $19million. This will be executed under a legal arrangement that will protect you against any legal ramification. If this business proposition offends your moral values, do accept my apology.

I can be reached on: xxx@xxx.xx

Best regards,

Kun Chun

Pues eso: un pobre hombre se muere en el tsunami de Sumatra en el 2004. Ese pobre hombre (descanse en paz) se apellidaba igual que yo (mira tu que casualidad) por lo que paso a ser su sucesor heredando una fortuna de 19 millones de dĂłlares (ole). Y yo sin saberlo. Menos mal que Kun Chun se ha percatado de ello y me lo hace saber mandandome un email.

Internet es genial. Hoy he ganado 19 millones de dólares sin hacer nada. Entiendo que al amigo Kun tendré que pagarle algo pero pida lo que pida se lo merecerá. Menos mal que este correo ha pasado el filtro antispam porque de otra manera no me habría enterado.


Acabo de recibir un correo con propaganda de un antivirus. Es una lástima que no use antivirus porque el producto tiene una pinta buenísima. Literal copiado del correo:

Máxima eficacia del mercado en detección de virus (99,65%).

Una eficacia ni mas ni menos del 99,65%. Nada del 99% ni de un mĂ­sero 99,5%. Me ofrece un 99,65%. No se como se calcula ese porcentaje pero tiene muy buena pinta. Hombre mejor seĂ­a un 99,73% o un 99,82% pero la verdad es que un 99,65% esta muy bien.

Ademas me dicen que el producto esta:

Basado en la tecnologĂ­a del lĂ­der en detecciĂłn de virus de [nombreDelAntivirus] Lab.

Es de agradecer. Parce que tienen un laboratorio dentro del cual tienen varias personas y me ofrecen la tecnologĂ­a del lider de ellos. Nada del mas pardillo ni mas ni menos que del lider.

Y lo que mas me ha asombrado:

Escaneo continuo de e-mails y del tráfico de Internet.

Con un par. Escaneo continuo de todo el tráfico de internet.

En fĂ­n, es una pena que no use esos productos porque si no este antivirus seria mi primera opciĂłn. Estoy seguro casi al 99,65% de ello.

virus letal

He recibido un aviso muy importante:

Si recibes una llamada al mĂłvil, y en la pantalla aparece INVIABLE con DOS signos de exclamaciĂłn (‘!!’): NO DESCUELGUES EL TELÉFONO, NI INTENTES RENUNCIAR A LA LLAMADA. DĂ©jalo sonar hasta que pare, y despuĂ©s borra directamente la llamada perdida. Se trata de un virus muy potente que destruye por completo el mecanismo del telĂ©fono: cuando esto pasa es imposible arreglarlo o tratar de encontrar una soluciĂłn al problema.

Esto me parece el no vas. No solo es el virus mas destructivo del mundo mundial, sino que además te impide tratar de buscar una solución al problema.

Que Dios nos pille confesados.

Cambio de Blog

Es oficial. Me paso de blogger a wordpress.
Empezé a usar bloggger no se muy bien porque. Es fácil de usar, un par de clicks y los tienes en marcha, pero cuando quise empezar a poner código fuente me encontré con problemillas:
Que si toca el template por aquĂ­, que si cambia los css, … En fin que no me apetecĂ­a hacer hacking en una herramienta propietaria como blogger (que yo sepa no se publica el cĂłdigo fuente aunque las modificaciones de templates están documentadas). AsĂ­ que me abrĂ­ una cuenta en wordpress. HabĂ­a instalado y jugado un poco con wordpress hace tiempo y no me gustaba mucho, pero al descubrir que dan hosting gratis me lanzĂ© a probarlo y no lo cambio por blogger ni en pintura. Ha mejorado mucho desde que lo vĂ­ por primera vez.

Después de hacer el arduo trabajo de migrar todos mis posts de blogger a mano (eran la desorbitante cifra de 4). Me doy cuenta que podía haberlo hecho semiautomático exportándolos en blogger e importándolos en wordpress. En fin que se le va a hacer.

Por cierto el cĂłdigo fuente queda monĂ­simo sin tener que tocar nada.