March 30, 2012

Jogging for fun

As a software developer and avid reader, I tend to spend a lot of time sitting or laying down in a bed. And this is normal for my life, I would say that at least 10 hours in my normal day are based literally on my ass.

When I started working I noticed this, and I knew I had to do something to keep my body as trained as my hands and brain were. So I decided to go back to an old costume I adopted while I was writing my thesis... jogging.



Jogging is a very simple discipline where you set a target destination and run at a certain pace, fast enough to not be walking, slow enough to keep your stamina.

The benefits

These are personal facts, that might not apply to everybody:
  • Relaxation, it keeps you away from your daily problems for some hours, clearing your thoughts and mind.
  • Concentration, well... you need it, you have to control your legs, your breath, and your speed while checking what's in your way.
  • Fitness, it keeps your middle-body in a good shape, if you do it regularly.
  • Discipline, you need a lot of will to jog when it's raining, when it's cold, when it's hot. 

How much?

After some years of irregular practice, I have set my jogging sessions to 30-45 minutes, it could be longer, but definitively not shorter.

What about the speed?

It depends completely on you, when I haven't done anything for a while I have to recover the muscles and pace I start slowly and then increase the speed day by day. As a metric, use your breath, if you get too tired or just too agitated, you might need to slow it down.

How to keep it interesting?

It could get bored, specially if you follow the same route for several days in a row. What I enjoy doing is listening to some podcasts while running, or perhaps some music. For this situation a portable iPod is the best choice.

March 6, 2012

Liquibase: Database change management

When you are developing an application, is almost sure that you will have to deal with a relational database system. And if you are developing with a 'refactoring' point of view, your database structure will change from time to time.



In many situations these changes have to be tracked and automatically applied for the different environments (development, integration, production) and I bet you are currently doing that manually, updating scripts and wiping databases back and forth.

This is no longer the case for me, a while ago I started using DBUnit for managing my database data changes, but as the development moved forward, the database structure changed as well. So we started looking for a tool that could simplify our lives.

Guess where we found it, in the DBUnit FAQ page, they even recommend it!. The tool is Liquibase, a java-based application that uses XML changesets to handle the database modifications, it works smoothly and support almost all productive database systems. It might be a little bit hard in the beginning, but it is worth it.

March 2, 2012

Dead code evilness

Working on several projects at the same time is really exciting, you have to administer your time-sheet between tasks and work with different people. Hence the diversity, different technologies and environments.
But there is something common between all those projects, dead code. Dead code can be classified in some few categories:
  • Legacy code.
  • Refactoring-result code.
  • Patches.
It's really frustrating for someone during development to see some code like this:


  • What does the '0' mean?
  • Why is the first line still present there as commented code?
  • Is it really important to have it there?
  • Should I remove it?
  • What about the other parameters?
  • Why it was commented in first place?
  This can lead you to several problems if you don't know how to answer these questions. But then again, why would you? Wouldn't be better to have something like this?:



If it's dead code, I mean, it's already dead, it should be removed for the sake of other developers. If you are working with Revision Control Systems (and I don't know why you shouldn't), the commented code is not longer required, you can revert or reapply a patch whenever you want.

In summary, get rid of your dead code, kill it, burn it, bury it.