Ayende @ Rahien

Refunds available at head office

Low pain tolerance

I am coming back to a project that I haven't been a part of for about six months. It was in active development during that time, and I was happy to get back to it, since it is a really good code base, and a fun project beside. The team that handle this project is top notched, but my first reaction was something in the order: "how could you let it turn so hard!"

Then I toned it down a bit and started Big Refactoring. About fifteen minutes later, I was done, which didn't match at all my initial response, and took some thinking. Why did I react this way? Why did it took ~15 minutes to turn something that I found awkward to something that was really pleasant to work with?

How could the other team members, all of whom are very good, have gotten into this situation?

The answer is both that I over reacted and that the expectations that I had from the project where high. We have made working on this project very smooth experience, but as time passed, it started to get awkward to work with. By that time, I wasn't around, and the developers just dealt with that. It isn't painful or hard, it is not bad or annoying. It is just that it began to get awkward, in a project that was really smooth sailing.

Those 15 minutes were spent mostly in breaking apart a few services, setting up a registration rule in Binsor and relaxing in the glow of content that Things Just Work once again.

I came to the conclusion that different pain tolerance levels are responsible for my reaction. I have very high expectations from my code, and I expected that it would continue to be as easy as it was in the start. The devs in the team would have likely performed the same actions as I did, at a later date. But I found it painful now.

It is especially interesting in light of the recent discussion about code size and scaling a project higher.

I think that having a lower pain tolerance level is a good thing, if kept in check.

Comments

Mischa Kroon
12/28/2007 09:56 AM by
Mischa Kroon

Personally I have a very high tolerance for pain.

And I like it, not only can I get work done until I actually start feeling the pain. But I can look / re-use other people's code without having to do serious rewriting.

That said when I do have to refactor I'm probably worse of then you :)

Mr_Simple
12/28/2007 03:50 PM by
Mr_Simple

Personally, I have a low tolerance for pain. Keeps my projects as simple as they can be (for having software involved) and makes them a joy to return to work on.

Alex Simkin
12/29/2007 02:01 AM by
Alex Simkin

What I do not believe is that all that you did took you 15 minutes. Just checking in the changes through the automatic build/test takes me 15 minutes or more. What size of project is that?

Ayende Rahien
12/29/2007 02:30 AM by
Ayende Rahien

Alex,

not sure how to answer that. 170 KLOC or so, but I don't like this measurement.

As I said, it was mostly modifying the way some key parts works. Routing them through Binsor and extracting a few interfaces.

Pierre Henri
12/29/2007 08:01 AM by
Pierre Henri

When I start working on an existing project with a relatively complex structure, my first inclination is to refactor it the way I feel it should be.

Then I realize that I mostly made "cosmetic" changes and the reason I was feeling uneasy was because I wasn't used to the architecture yet.

In your case, try asking to the developer of this project what they think of your changes; my bet is that they will also feel uneasy about them at first :)

Ayende Rahien
12/29/2007 12:08 PM by
Ayende Rahien

Pierre Henri,

That is my project. I was the lead there for about 9 months with the same team.

Pierre Henri
12/29/2007 12:56 PM by
Pierre Henri

I meant "the other team members"; those who "got into that situation".

Alex Simkin
12/29/2007 04:28 PM by
Alex Simkin

My question wasn't about number of LOC's, it was about timing:

  • Check out

  • Write test

  • Build/Run Test see it fail

  • Write code

  • Build/Run Test see it green

  • Check in (Build/Run all tests)

Everything for ~15 minutes. Plus some documentation that system has one more configurable parameter now.


We have a lead developer on one of the projects with very "low pain tolerance". So low that she touches all of the code written by other developers. Sometimes it offends people, like:

Dev: Why did you change the parameter of lambda from c to p? (Changed c => c.Name to p => p.Name)

L.D: P stands for Person

Dev: C was for Customer

L.D: Customer can be Person or Company, c is misleading here: someone might think that c stands for Company or Corporate Customer

Dev: Whatever...

Ayende Rahien
12/29/2007 04:57 PM by
Ayende Rahien

Alex,

Checkout is not needed, I already had the code.

Tests were not needed, I refactored the code, not changed the behavior. I could utilize existing tests.

Writing code was mostly unnecessary, I mainly moved files and code around.

Running tests doesn't take that much, but I wouldn't include it in the 15 minutes that I quoted.

Hernan Garcia
12/30/2007 08:48 AM by
Hernan Garcia

Twelve years ago I have hight tolerance for bad code, I didn't mind and keep going doing my thing fixing the bugs with the minimum changes needed to keep things working.

As time pass my level of tolerance is getting lower and lower, I can't even left my own code along if I know that refactoring needs to be done.

This is generally a good thing, but lots of times I found myself doing way more work that's needed.

Later on I decided to fix the bug asap, and open a case in our defect tracking system to re factor later, this is working pretty well, since I can get patches faster and them do the refactoring one or two days later.

Comments have been closed on this topic.