Devise and CanCanCan, Agile = prepare for the worst?

3. January 2017

I wasnt using CanCanCan before, and wasn’r really planning on it, but I thought, what the heck, it might be fun. My project was simple… at the start. But in the end it got more complicated.

It is agile development I guess, but does it also means changing core programming constantly?

CanCanCan and Devise ( I wasn’t even planning on using Devise but a friend told me better to use one ) wasn’t going to be used because I feel they are a bit overkill.

But at the start I only used Devise and add a

def role
'admin'
end

in my User user.rb model. It is still like that, but since somehow the task was getting bigger and needed to have more complicated rights to its actions and views, I implemented CanCanCan. I was still feelign a bit overkill at the time, but then since the Agile development, it fulfills its role nicely.

That got me thinking though: is Agile development just a buzz-tech-savvy word for an “unclear” planning?

Let’s take an analogy here: An artist making a sculpture of a head, starting from a block. On one block, he just chips and chisel away, without any planning. The end result is still a scuplture, might even be one with a good life-like face. But I would think that he might face difficulties when he chisels too much. Maybe the back of its head chiseled too much. Now it is almost impossible to add again to the block. The end result could be patched and you would see the seams.

On the other block, he draws a sketch lines on the suface the block, planned a bit on how big the head would be and makes a sketch on the paper. The picture might have a detailed portion of it, and also some portion that is quite unclear – but the rough lines are there. Now with a guide, he’s chiselling the block more confidently. The room of error is now narrowed. If he is starting to take away too much, he might stop at the right time guided by his sketches. If he does make an error, he can only then at least think, well, it was planned that way, I might plan differently in the future.

I guess what I am trying to say is, a plan is better than no plan – of course everyone knows that, but the more detailed a plan can be, the less room for error and the clearer the vision is. I think this is what architects are doing with all of their Detailzeichnung or detail drawings.

But yeah, at the end of the day CanCanCan saves my ass.

case user.role
when 'cancancan'
# Saves me ass
else
# coding hell
end