Thursday, July 11, 2013

I was beginning to worry, what with all the complexity in our code.

Done. I just had to implement the repository pattern, refactor all our data access code into concrete repositories, pull in an IoC framework, add two levels of base classes to all our controllers while refactoring the action methods and view models, and wire up our new IoC config.  Now we have testable code!

It took me quite awhile to get used to the idea of intentionally eschewing design correctness in code for the sake of creating code that can be easily supported by one person -- simpler code. As noted in this article, complexity is often ignored, but it can be a major "cost" over time.  Clearly there is a time and place for "doing it right" but when you are writing smaller scale applications and are required to support them with little/no help, I think it's critical to abide YAGNI and be deliberate in what rules you follow and which ones you break in the solutions you choose to implement because in my experience 'doing it right' tends to mean more lines of code, more dependencies, more abstraction, and more indirection -- more complexity. 


 
Title: I was beginning to worry, what with all the complexity in our code.
Snarky: Done. I just had to implement the repository pattern, refactor all our data access code into concrete repositories, pull in an IoC framework, add two levels of base classes to all our controllers while refactoring the action methods and view models, and wire up our new IoC config.  Now we have testable code!


No comments:

Post a Comment