An Event Aggregator is an example of a Publish/Subscribe channel. A while ago i started wondering if we still need an Event Aggregator in our compisite applications if we have an IOC container that takes cares of dependency wiring. An IOC container can easily inject the Event/MessageHandler(s) in the Event/MessagePublisher(s)… I’m still not sure about the answer (Yes/No).
Tag Archives: Information Technology
Do we need an EventAggregator when we have an IOC container?
About dependencies
This weekend i noticed a couple of posts by Uncle Bob trying to get some discussions going. In Mocking Mocking and Testing Outcomes at some point he generates a fake of some class
“Oh, ick!” you say. Yes, I agree it’s a lot of code. On the other hand, it took me just a single keystroke on my IDE to generate all those dummy methods. (In IntelliJ it was simply command-I to implement all unimplemented methods.) So it wasn’t particularly hard. And, of course, I can put this code somewhere where nobody had to look at it unless they want to. It has the advantage that anybody who knows Java can understand it, and can look right at the methods to see what they are returning. No “special” knowledge of the mocking framework is necessary.
So adding a lot of generated code, which no-one should ever look at, is better than a mocking framework? Hahaha, why would i want to repeat myself creating all those fake objects? (DRY)
Another problem that i have with his example is the fact that the ‘dependency’ has a ton of methods that are not used by the consumer, so it makes me wonder: why are those methods there? Define an interface for the required methods, and have your consumer use that interface instead. This way you don’t have to look at those unused methods which only clutter the API.
A second read made it clear that Uncle Bob is talking about unit-tests, which are typically implemented as state-based tests. In case you’re doing integration tests, you will have (more) dependencies and want to verify the interaction between your system under test and the dependencies. And that is (imho) the scenario where mocking frameworks really shine
About forced design
if you need typemock your design is wrong.
Although i understand what people are trying to say with that quote, it’s wrong on many levels. I pretty much agree with everything that Roy wrote in Test driven design – Willed vs. Forced Designs. As some commenters pointed out it is hard to convince management that they need an isolation framework, let alone that they have to pay for one.
A couple of thoughts:
- What about Pex Stubs & Moles? It uses the profiling API (less limitations than rhino/moq/…) too and for a lot of shops doing .Net development it’s free.
- I really don’t understand people that are unwilling to pay for tools that can contribute to the generation of business value (eg: Resharper, NCover, NDepend, …) when they don’t come from Microsoft.
- Filling up gaps in the .Net/Microsoft space seems like an awful business model.
Bing vs Google in 5 seconds
A while ago i sat in a meeting and some ms-fanboy used Bing to find out how much 60 inches were in meters. The first page had pages with conversion factors but none of them contained the actual answer. I suggested that he’d use Google instead and while he was keying in the question the answer already appeared.
Today i wanted to make a screencast of this difference in experience but it seems that bing has the ‘conversion’ feature now too. Wondering about what would make me switch search engines…
Configuring Apache to serve Office 2007 documents with the correct MIME type
Untill now i haven’t published any Office 2007 documents but i noticed that my webhost hasn’t configured apache to serve such documents with the correct MIME types. This resulted in my web browser downloading .docx files as zip archives. Here’s how a couple of additions to .htaccess tackle the problem:
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
AddType application/vnd.openxmlformats-officedocument.presentationml.template potx
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
AddType application/vnd.openxmlformats-officedocument.presentationml.presentation sldx
AddType application/vnd.openxmlformats-officedocument.presentationml.slide sldx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
AddType application/vnd.ms-excel.addin.macroEnabled.12 xlam
AddType application/vnd.ms-excel.sheet.binary.macroEnabled.12 xslb
About under construction pages
Why do people visit a website? To find information. Thus, when you publish a page to announce that the information is not there (yet) you are wasting your visitors time. Instead of creating the actual content you wasted time while your were creating an under construction page. A loss-loss situation instead of a win-win one.
Admitted, in some cases it can be helpful to give your visitors an idea of what they can expect (eg: links to articles that are not written yet appear in red in the Presentation Patterns wiki), but in general: Under construction pages stink. And here is someone who shares that feeling: This icon says more about me than it does about my web page.
About reading books
A while ago Gabriel wrote the following:
PS3: you can read all the books that you want, in the end to truly master .NET you need experience and more experience! Normally it would take you about 10 years of relevant experience to get to that level of expertise
I agree that expertise only comes from experience but i do believe that good books can guide you to the pit of success and help you recognize solutions that are doomed to fail.
Adding items to SendTo folder
First thoughts about Windows 7
It is almost two years ago that i decided to uninstall Vista after a bad first impression. Nowadays i have learned to live with it, but i guess i will never understand what all the fuss was about.
I can imagine that the marketing department will generate a lot of noise about Windows 7 but i am not convinced that there are actually people waiting for yet another OS. Anyway, i installed Windows 7 somewhere last week and i must say that i am pretty pleased with it. I guess that you didn’t see that one coming, do you? Me, finally liking an operation system that comes from Microsoft
PS: Forgot to mention that i do not like the fact that i can not have Windows Virtual PC and Virtual Server 2005 at the same time :/
Sparkles
In my opinion Pieter Gheysens is one of those persons that has contributed something valuable to the Belgian .Net community: Great Visug sessions and some interesting courses at Compuware so i shamelessly plug his new company Sparkles here. Now go and find out how they can make you a better developer!


