I’ve started to bring this “spike” to a close since I’ve set out to figure out the stuff I needed to using a few Azure services and got to a point of refactoring. When I get to this point with a spike, I set out to do the following things listed in the task list you see here. I’ll step through the why for each of them.
- Refactoring for Interfaces – I tend to build up a few concrete types which don’t need to be added to an IoC container for injection, I try not to abuse Unity even though it’s pretty awesome. Until I find out that maybe a member needs to be injected to reduce a bit of coupling across the solution. So, I’ll look for these opportunities across the solution and extract an interface and either add it to the container or do some poor man’s injection w/o the container – it just depends on the context of the type’s usage. I agree, more interfaces are better, even marker interfaces serve a purpose but I try not to go crazy with anything, interfaces included.
- Logging – At this point, I know more than I did a few weeks ago and I’ve got a clearer idea of what I want to log. This time I just need to build up the event source class for the app based on what I learned. That’s it. No more, no less.
- Magic Strings and Numbers – This one is special. I litter the application with strings and sometimes numbers and this is the best time to go back over the entire solution to pull them out and into something like constants, that’s what worked for this exercise. I’m walking through all of the code to see if it makes sense, especially the bits that I’ve not seen in a few weeks. I forget sometimes what I was thinking, and clarifying with a better member or method name is always better than adding comments. And yes, I’ve got a small battery of tests to fire off after each changeset gets checked in.
- Plumbing for cross-cutting stuff – Now that the logging events are done, I need to plant them in the classes that are doing the work.
Not much here, just some habits I’ve been using over the years to keep solutions clean, readable, and hopefully maintainable.
HTH / oFc