Ayende @ Rahien

Unnatural acts on source code

Tools vs. Design

Just read this, Eli Lopian talks about how you can use Type Mock in order to avoid separating responsabilities:

I am going to show you just how we can manage to unit test a Simple Dialog without separating concerns

I have a problem with this statement. Why would I want to avoid separating concerns? The Single Responsability Principal & Separation of Concerns are critical to building maintainable systems.

Comments

Casey
06/11/2007 07:19 AM by
Casey

The only possible explanation would be legacy code you can't change. But then, perhaps a quick refactor of the code, followed by your unit tests is in order.

The more time you put into a unit test to make it work around limitations in your design, the more likely you are to introduce new and wonderful bugs, probably in your unit tests.

I think this falls into the same bracket as unit testing private methods... it implies something is rotten in the state of Denmark!

Eli Lopian
06/11/2007 01:28 PM by
Eli Lopian

Oren, you should read the end of the sentence that you are quoting

"and overcome the forbidden decree that GUI is hard to test"

This is the reason to avoid separating concerns.

Our differences are not Tools vs Design but Design vs. Process

http://www.elilopian.com/2007/06/11/design-vs-process/

Wendy
06/11/2007 02:01 PM by
Wendy

I've worked with plenty of people that argue that separation of concerns and single responsibility increase complexity and make code too "abstract," so they probably enjoyed the article :P

Ayende Rahien
06/11/2007 02:37 PM by
Ayende Rahien

I have read that, but I don't agree with you on this.

It is not that GUI is hard to test, (and it is, even with TypeMock, because you have complex user interactions), it is the permise that you shouldn't design for SRP & SoC that bother me.

Comments have been closed on this topic.