design
There are 5 entries for the tag
design
My last two posts regarding Rhino.Mocks, attracted quite a lot of attention. Focusing on solution I proposed for limiting complexity around creation different kinds of mocks, one thing was pointed out by few people as not the best solution. Ayende called it "in your face! API design", that is stating the kind of mock you want to create explicitly, via method parameter. I don't think that doing it via method name is any less explicit, but let's not go there. Instead, let's think for a while - why do we need 4 kinds of mocks anyway? All differences boil down...
Just a small idea before I go to work. As follow up to my yesterdays post about Rhino.Mocks. I figured, that instead of supplying arrays of object for constructor parameters, which is error prone and doesn't give you the safety of compiler checks, we can actually insert the call to constructor using Expressions (notice that this is solution that will work only in .NET >= 3.5). Here's quick and dirty sketch of remade method: public TTypeToMock Mock<TTypeToMock>(Kind mockKind, Expression<Func<TTypeToMock>> ctorCall, params Type[] extraTypes){ if (extraTypes == null) throw new ArgumentNullException("extraTypes"); if (ctorCall == null)...
Here's the problem: Having some ID, get a new instance of some class corresponding to this ID. All classes implement the same common interface (by which we will use them). So we need to be able to write something like: public IMessage DoSomethingWithMessage(Id id){ IMessage message = MessageFactory.CreateMessage(id); message.DoSomething();}
Now, how to actually implement MessageFactory, knowing that it needs to be really fast, and without having to explicitly change its implementation when new messages are added, Ids change and so on? And how to bind IDs to Messages?
Here's my idea for the solution, and...
I recently found this great website called Internet Archive:Wayback Machine. Basically it lets you see snapshots of different websites starting from 1996 to present day. I found this fascinating for at least two reasons. It's fun. To see how Microsoft's site looked back in 1996, or alpha version of Google. The other (more important aspect to me) is - this site is a great learning tool. Like in movies you can go back in time and jump between eras, see how the world changed. How sites we visit every day looked like few years ago. It may be eye-opening,...
You know who Krzysztof Cwalina is - right? The Framework Design guy. He recently gave a lecture on that topic at Microsoft Research center, and now he made it available for download. I haven't seen it whole yet (it's iver 3h long!) but i strongly recomend it. Get it here, and if you didn't already - subscribe to Krzysztof's blog: here. Technorati tags: Krzysztof Cwalina, .NET, .NET framework, design, lecture, Microsoft