Ayende @ Rahien

Refunds available at head office

Things that scares me

I had run into something today that I have no idea how to respond to. I was working with someone and at one point I did a WAIT A MINUTE, What Just Happened?!

He then proudly showed me how he improved his daily work flow. He has modified the VS #region template so he was able to select a piece of code, hit a few keys, and get the following:

 #region old
/*

selected code...

*/
#endregion

You can guess how the code base looks like, I assume, which this technique in place.

If you twitch, it is complex

I had a funny moment today at a meeting, here we were, calmly analyzing what we need to do, when the client has said the Wrong Thing. "We need to add XYZ to the search page". Me and a coworker had a simultaneous twitch at this. I felt like jumping up in slow motion and screaming "Noooooo!!!", like in a bad cop film.

The search page is undoubtedly the most complex piece of the application. Just the UI portion of the result grid alone was took about two days to build. A quick calculation showed that we have ~15 classes that take parts in building this page, it is interacting with at least three other pages that I can recall off hand and can do anything from producing reports to making coffee. To be clear, the ~15 classes that I am talking about, they are not domain classes or infrastructure stuff, those are classes that exists solely for this page. It is not a page, it is a module, but all of its functionality is exposed

Then I took a deep breath and remembered that I actually have (lots of) tests in place for this, that I am actually capable of running them and that the code is good code. 

I still don't want to touch that page, the last time that we did, we broke this:

  • Search something
  • Move to the third page
  • Order by date descending
  • Click on second result and go to details page
  • Click on another link in the details page
  • From the second link, go back to the search page (verify that you are still in 3rd page, ordered by date descending)
  • Click on second result and go to details page
  • Click on another link in the details page
  • Boom!

I can do any sort of change there, and objectively, there isn't anything there that cannot be safely changed, I can assert that my change didn't break existing functionality (except stuff like above, which we didn't have a test for). Nevertheless, I would like to leave that alone. It is perfect as it is right now, both from UI perspective and from code perspective.

I am afraid of another tree view incident, frankly*.

I wish we could apply SRP to UI.

* Seemingly simple change, with cascading complexity as you start to understand what is required.

New from ThisIsScary.com

Can you guess what this picture is?

(Image from clipboard).png

This is a partial image from a trace from a simple ASPX page, just look at the amount of controls that are involved in producing a page. Now go figure out an issue with page lifecycles of siblings please.