Archive for February, 2010

Beware of the silent Machinist

Posted in Uncategorized on February 28th, 2010 by Marcelo de Moraes Serpa – Be the first to comment

When using Machinist to create your fixturish objects, be aware of errors on an associated object, it can get to weird issues where the attributes after the association definition just won’t be assigned (probably because an exception happens and it gets out of the flow of assigning the attributes, I haven’t dug deep into it as I could find a way to fix it, but if someone knows the inner-workings of machinist and could explain better than I do, feel free to comment or send me an email).

For example:

Post.blueprint {
user
title { “Sample” }
}

If an error happens when trying to instantiate the user object (a belongs_to relationship), the title attribute won’t get assigned, no matter what. And worst, in my experience, it will fail silently.

To fix that, just try to find out why the user object might be failing to instantiate. You can try to create a user blueprint and see what errors arise when you make it. If you put the “user” declaration at the bottom of the blueprint definition, you will get a kind of work around, but I don’t recommend that, since you will still have the errors and it could cause something worst later on.

A good focusing tool on orgmode

Posted in Uncategorized on February 23rd, 2010 by Marcelo de Moraes Serpa – Be the first to comment

Public announcement: If you haven’t checked out orgmode, you should do it. It is the awesomest piece of software I’ve ever known. It is a reason, by itself, to use emacs, even if you keep using your other favorite editor for mundane editing tasks. Check it out on www.orgmode.org.

Now onto the quick tip. Orgmode has a org-agenda-set-restriction-lock function, which can be used to restrict agenda searches to the specific subtree. After you apply it to an item, only its children will be taken into account when you make your queries through org-agenda.

If you type C-h f org-agenda-set-restriction-lock, here’s the doc you get back:


...
Set restriction lock for agenda, to current subtree or file.
Restriction will be the file if TYPE is `file', or if type is the
universal prefix '(4), or if the cursor is before the first headline
in the file. Otherwise, restriction will be to the current subtree.

While it is useful for its original purposes, I also use it as a simple focusing tool. I’m the kind of person who gets lost easily and that gets high-value from a well written todo list, and that includes a visual clue on what item I’m working on. This command sets a background color that can be used just for that.

Just put the cursor you want to be “highlighted”, and type C-c C-x <.

Keep in mind that this will restrict any subsequent org action to this item, so, don't be surprised if you agenda view breaks. To cancel it, just type C-c C-x >.

GTD and software engineering, a pragmatic approach

Posted in Uncategorized on February 23rd, 2010 by Marcelo de Moraes Serpa – Be the first to comment

GTD is a great systematic approach for getting on top of your world. Being a systematic approach also means it is general enough to cause confusion (i.e: not be clear) and to be applied to virtually any aspect of life, and that includes any particular needs you might have.

GTD works on top of 3 models. The first one, called the Mastering Workflow is the best known, and the essence of David Allen’s first book. You’ll surely remember the Collect, Process, Organize, Review, Do steps.

The second model is the Natural Planning model – it’s basically used to clarify amorphous data into clear next actions (as wel as finding out why you are doing it at the first place).

The third model is what David calls “Horizons of Focus”, and defines the different levels — or horizons — on which we need to focus in order to get a good perspective about our world.

Anyway, the point of this article is not to teach you GTD. It is deep enough to require a book of its own :-) (Check out the Getting Things Done and or Making It All Work books).

When developing software, we are bombarded by a constant flow data, this comes from different sources:

* Our our mind triggers it;
* Someone else asks us to do it;

Most of the time, this data is amorphous, sometimes it doesn’t even have clear goals. Not a good day to be a software developer uh?

Well, whenever you have to deal with that, you need to quickly capture. Try not to get out of the context you are. Capture it and trust that you will deal with that later. If you judge the task will only a quick while and that it is clear enough and you are not doing something already, do it. Any other notes you might have during the time you are doing the task, just take note (capture it) and forget about it for the time being.

David talks about cranking widgets. He says that there is always a set of very clear and “physical” actions that you can break down from any unclear task.

The thing is: Defining the “widgets” is very subjective. But the good news is that you just have to break it down until it has enough information in it and makes sense to you.

For example:


* System should deal with ARB requests

Is definetly too high-level. You will break your head a little bit and it will cause you anxiety if you just keep it like that. It doesn’t matter if tell me Cucumber will save your life. You will eventually finish the task, but it will take much more mental energy. So, start breaking it down:


* System should deal with ARB requests
** Create the system_should_deal_with_arb_request.feature feature file on feature/
** Write the story on the feature, check with Tommy
** Brainstorm about the scenarios, 25 minutes timebox.

Now, this is the part I told is subjective (and this is the main poin tof this post), and depends on the person. Know what ? Just put whatever you feel you need to remember. These are reminders, after all. Just try to be clear enough for your own understanding.

(You can see that most of the time, not everything will be clear, and a reminder to process something even more will be very helpful, such as brainstorm about scenarios. The point is to extend your mind and let you know what you need to do, you don’t have to clarify everything upfront, that would be crazy, and you would probably be following something akin to the watefal development methodology).

Then, to decide what’s is the next action, you can judge by time, priority, energy, and context. You can start the day looking your GTD next-actions list and decide, depending on your current circunstances, what is the best next choice. You might decide you don’t have enough information, and that’s ok, just plan on it, but be sure to set up any needed reminders for next-actions or new projects/sub-projects that might appear.

You might even modify the /delete the todo-list, or change the order, you are the judge. Be flexible, be pragmatic, GTD is a systematic approach and not a defined system. You have the whole inventory in front of you, and if you trust it (which takes some time) you will free up much more energy to actually execute.

Gem Bundle and ActiveMerchant woes

Posted in Uncategorized on February 15th, 2010 by Marcelo de Moraes Serpa – Be the first to comment

Please, don’t fall in the same almost-infinity-loop I fell.

Firstly, an outburst of mine — Gem Bundler is true quest to setup. It is an wild adventure.

Don’t get me wrong, the tool is amazing, but the scarce and uncentralized documentation really makes it difficult to set it up, requiring you to go to Pluto, come back, stay a few minutes in the moon, a few hours in the edge of the internet and then, after a bunch of trials, get something solid.

Now, onto the issue I’ve been through, which is not really Gem Bundler’s fault.

After going through the amazing quest to set up gem bundle, I though I had it done. However, ActiveMerchant was not loading. What the heck? Every other gem was loading but ActiveMerchant.

Now, I don’t know why ActiveMerchant developers used active_merchant as the name of the main ruby file for the lib. Gem Bundler was trying to require ‘activemerchant’ (I had to debug the require method to find it out, even though I was suspecting that this was the reason) and the require was failing.

To solve it, simply declare your activemerchant dependency on your Gemfile like this:


gem 'activemerchant', :require => 'active_merchant'

Now, back to coding, more coffee, please!