Dogmatic? Who, me?
Jacob Proffitt calls me up to task for being inconsistent:
In this, Ole Friis is echoing the response I got from the intimidating Oren Eini when I suggested that TypeMock makes arguments that couple DI with unit testing go away.
The main weakness of Type Mock is its power, it allow me to take shortcuts that I don’t want to take, I want to get a system with low coupling and high cohesion.
The implication is that he wouldn’t be developer enough to create a system with low coupling and high cohesion if he used powerful tools like TypeMock. Oren is inconsistent here because he’s otherwise all for developer empowerment as illustrated by his support for Jeffrey Palermo’s excellent post regarding treating developers as professionals.
How can I support the idea of alt.net as "running with scissors", responsible adults that are trusted to know what we are doing, with my comments on Type Mock having "too much power"?
It is a good thing that I never felt the need to be self consistent. It makes things much more... invigorating.
I'll start by saying that I often write bad code. What is bad code? In DevTeach, I showed James Kovacks a 150 lines methods that involved threading, anonymous delegates and exception handling in a ingeniously unmaintainable form. Bad as in you will get the axe and come after me with froth coming out of your mouth if you ever see it.
I have a certain style that works for me. It comes with a set of tools and practices that are built to encourage that style and mindset. Being a lazy bastard, I am careful to make sure that I cannot be too lazy, because otherwise it is usually me who needs to clean up my mess.
I believe that the choice of tool has a profound affect on my ability to work. That comes both at the tooling level (IDE, extensions, R#, etc) and the frameworks sides (IoC, OR/M, DSL, etc). Tools & frameworks should guide me where I want to go, and make it harder to do the wrong thing. This is a decision that I made based on my experience and observations.
After dealing with tools that do not encourage best practices, or tools that forces you to work harder to get there, it is a very important consideration to me. I don't see an inherent disconnect between the two. I believe that the term is that "with great power comes great responsibility". Recognizing that, I intentionally limit my own choices, in order to get things done using the approach that I believe is the best for what I am doing.
Does this mean that this approach is a one size fit all? Absolutely not.
In fact, I can tell you that from each and every project I come out with a profound understanding of how stupid I was when I got into the project, and how many mistakes I made in that project.
But, I do believe that this approach is applicable for a broad set of scenarios. Not all, but a broad set of scenarios.
Comments
I would have replied to Jacob's post, but as he only has 1 sentence I can agree with ... I don't think it is worth the time.
Oddly the one sentence is "Claims of universal applicability for any pattern or development principle are always wrong." - but if he knew anything about you, he would know that is pretty much the basis for almost all of your posts and projects.
I like Rhino, I do like TypeMock too - TypeMock can allow me to test things that Rhino won't - SharePoint objects currently.
But if I hadn't created the abstractions over SharePoint that I have done and I had gone for TypeMock to get around the immediate problem ... I know I would have 10 times as many problems down the line.
It isn't about limiting yourself, it is about knowing what is the right way to solve the problem at hand.
MSTest being able to unit test private methods is a similar thing - if you are doing that, you probably have a design problem. Sure, you can do it, but should you?
"It isn't about limiting yourself, it is about knowing what is the right way to solve the problem at hand."
Thats the way I feel, I don't buy into being forced to do things a particular way.
In our domain model we tend to use TypeMock to mock our domain entities/services in testing, trying to do this with Rhino would involve us changing our domain model in ways that we don't feel are appropriate.
My point is that I always think you neeed to make an educated decisions so I'm happy to use TypeMock.
I often say, "That Oren, what a lazy bastard!. Five blog posts a day, heavy participation in every forum known, writing his own unit testing framework, contributing to several other OS initiatives. Can't he turn it up a bit and quit lazing around all the time!!!!"
Comment preview