tag:blogger.com,1999:blog-32609450.post1672433706481768307..comments2023-09-15T13:14:58.827+01:00Comments on Colin Jack's Blog: Interfaces and Abstract Classes In The DomainColin Jackhttp://www.blogger.com/profile/01403166737046938219noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-32609450.post-20792247764112595252007-11-23T16:09:00.000+00:002007-11-23T16:09:00.000+00:00"One reason for this is mocking (which I don't fav..."One reason for this is mocking (<I>which I don't favor for the domain anyway</I>)"<BR/><BR/>Could you please elaborate on the subject, please?<BR/><BR/>Personally, I find it very useful to mock (often concrete classes, and more often spies than mocks) object instances that require certain property values which are results of several transactions.<BR/><BR/>Creating a lot of factories for the tests is in a way testing already tested code.<BR/><BR/>It might be more work to refactor the spies/mocks than the factories, but that's not for sure (in my experience).MartinRLhttps://www.blogger.com/profile/17794301976274938698noreply@blogger.comtag:blogger.com,1999:blog-32609450.post-49586350744200981022007-11-21T16:38:00.000+00:002007-11-21T16:38:00.000+00:00Yeah it feels wrong to me too, but yeah I have cre...Yeah it feels wrong to me too, but yeah I have created them for testing too.<BR/><BR/>TypeMock is quite good as it lets you mock concrete classes or types so you can design your domain as you see fit and still have the ability to mock. There is also a free version which is quite good and has most of what you need(though not all of what you might want).<BR/><BR/>Having said that it does have its detractors not least as it lets you design code that is not mockable (which *could* lead to highly coupled designs)...but like I say I think things are a bit different in the case of your domain model and to be honest I don't do a lot of mocking when testing domain classes anyway.Colin Jackhttps://www.blogger.com/profile/01403166737046938219noreply@blogger.comtag:blogger.com,1999:blog-32609450.post-77504717414138794972007-11-21T15:23:00.000+00:002007-11-21T15:23:00.000+00:00I'm guilty of creating interfaces for the purpose ...I'm guilty of creating interfaces for the purpose of testing. Something has always felt wrong about creating these interfaces when there will never be more than one concrete (except during testing). At the same time, I feel that testing is important enough that maybe it's worth it until we come up with something better. I haven't tried TypeMock yet, so maybe that's the answer.Anonymousnoreply@blogger.com