May 23, 2012

Ant and Maven, a brief comparison

I've been working for the last three years and during this period of time the projects I've been involved with have the same discussion:

which build tool should I use?...and the most common answers were...Ant and Maven

You can check some statistics to see which one is going to rule the market, honestly I think Ant will never leave.



But I must say that there's a very important difference between Ant and Maven, Ant is task-oriented with the possibility of handling project-related configurations. And Maven is project-oriented with the possibility of handling task-related configurations.

Considering that, I have these questions that might help you to decide between the right tool:

Maven


  1. Do you need to keep standard project structures?
  2. Do you want to avoid manual tasks/steps?
  3. Do your projects have dependencies to another projects/libraries/frameworks?
  4. Do you have a fairly good Internet connection?
  5. Do you like to follow the Convention over configuration way?
Ant


  1. Do your projects are very different one from another?
  2. Do your projects have very different structures?
  3. Do you customize your projects so they behave in a very specific way?
  4. Do you already have a tight workspace structure that doesn't fit in the Maven world?
  5. Do you need to have full control over what your projects do?
Some of these questions might be incorrect, but those are the ones coming to my head right now, so feel free to use them or not.

May 15, 2012

Generic actions model

Have you ever tried to install something in a Linux distribution and have struggled with a dependency manager? such as DEB, RPM, PACMAN?

Dependency graph


I have a love/hate relationship with these models, sometimes they save my day, but some others are really, but really hard to deal with.

In software development you will find such scenarios, where you have something to do, and that thing will require another thing... and so on.

I mapped this model about a generic rule-dependency model:


  • Action: Component doing some kind of work. All the dependencies are one-side oriente, and each dependency can have many other dependencies.
  • ActionsRepository: A collection of sorted actions by any kind of criteria. Normally not allowing duplicated actions.
  • ActionsExecutor: Component in charge of iterate and execute the actions.

May 12, 2012

TDD helps you find the way...when you are lost

There are times when you start a project, and you understand exactly what it has to do, you know the inputs, and the outputs. You might know even some of the inner logic in between, but you can't get your head around it.

That is, not to know how to do it. Not to know where to start from and where you are targeting to. This problem arises almost always you are dealing with something new, something you have never done before and perhaps have ever seen.

That's been the case for me in some projects I've worked on, some times it took me a while to get the right idea, after hours/days/weeks struggling with the logic and the results verification.

In my first days, I would do the verifications by hand, a tedious process where I would reply all the steps in order to verify that everything is working as expected. If something got broken, I would fix it and then start the tedious process again.

This was painful, and exhausting, that loop trapped me for months. I thought that someone else would have found a way to get this done without that much effort. Then I started reading about testing techniques, leading to best practices, disciplines....a hole world of professionalism and engineering is out there, you just have to seek it.

The concept that fit for my problems was TDD, it applied for the situations I experienced and its scope is what I was looking for, the cycle looks like this:



with automated tests and frameworks, and the most important....you know that you are done when you can't think on more tests to write!!!

I strongly suggest you to give it a try, it's a discipline that will make you a better, more responsible developer, and also will provide you a way of building targeted products in a safe way.