Interfaces seem to get in the way when refactoring (But that could just be because I'm so close to them...)
Written by
on
in
Snaking.
Much of yesterday was taken up fixing a design flaw in the EFT server. In essence, I'd modelled transactions as abstract objects to which messages should be attached. That's fine, but it's overkill for what we're actually doing, and makes everything rather slow.
The solution was to make the messages themselves model the transactions. That is, rather than having a transaction object holding a message that says "CC sale" which knows how to insert the record in the database, check for return-value, etceteras, just have the message saying "CC sale" know how to do that and define an interface which it implements.
I spent quite some time editing, then re-editing the interfaces (and then every object which implemented the interfaces) as I was working. In the end, there was only one change to the interface, and only 2 other files needed to change to support that, but while I was working, keeping them all in sync was a bit of a pain. I'm guessing the proper TDD approach is to only fix them when they actually break something, but that seems... scary :) .
Pingbacks
Pingbacks are closed.
Comments
Comments are closed.