If you twitch, it is complex

time to read 2 min | 391 words

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.