April 2008 Entries
I don't usually do that kind of things, but now I feel obligated. Well, here's the deal: Microsoft has put together a promising set of extensions to C# called spec#, that you can read, hear, or watch about, and even download it. It's a very nice set of features like non-nullable value-type fields, preconditions, postconditions and more. Those are very helpful features, and I want to join the movement on the blogosphere, that arose spontaneously to show Microsoft that we do care about those things and we'd love to see those features incorporated into C# 4.0. ...
Globalization is a serious issue if you create a software that is to be used worldwide. You may for example take into account that people have non a-z letters in their names, like for example 'ź'. If you don't consider that, your users may come across windows like this one, I saw while registering to Windows Live Spaces. So what should I do? Lie about my last name? And the funniest thing is: there's no 'ź' on the list of forbidden characters. Technorati Tags: Microsoft, Office, Globalization, l10n, i13n
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)...
[UPDATE]: Example code is updated. I realized that Kind.Multi is not needed, since you can infer that from passed parameters (when ctorArgs are present, user obviously wants to create MultiMock). I also changed default Kind to Relaxed, since this is the most common one. Ayende wrote today about his ideas for new version of Rhino.Mocks. I like the new syntax (looks similar to what MoQ offers), but there's one more change I'd like to see. Here's the list of all methods of MockRepository, used to create some kind of mock: public T CreateMock<T>(params object[] argumentsForConstructor);public object CreateMock(Type type, params...
On IL level, when you're accessing method's parameters there's a <sarcasm>small</sarcasm> difference between static and instance methods. Instance methods have implicitly 0th parameter set to this. So if you want to access your 1st parameter in instance method you have to emit ldarg.1, and in static method you have to emit ldarg.0. It's basic OO, yet it took me 2h to find out that this was the cause why my DynamicMethod was throwing NullReferenceException. I created a method that looked kind of like what I wanted my dynamic method to look like, and looked at its IL in Reflector. It...
Ok, maybe this title is a little bit too catchy. However, I simply love the expressiveness of this little piece of code I wrote today. 1: public bool RegisterAll( Assembly assembly, Func<object, bool> isValidMessage ) 2: { 3: if( assembly == null ) 4: { ...
I love reading blogs. I gain so much knowledge from people far smarter than myself. In my previous job it was taking me about 40 minutes to get there, and another 40 to return home. It's quite a lot I guess, wasting over an hour in public communication. Then to make my commute a little bit more productive (ok, I lie here, it was just boring) I decided to use my old Creative Zen Micro mp3 player, and listen to podcasts. That's how it started, and now I have yet another source of knowledge about technology, and what's great about...
I'm speechless. Technorati Tags: Johnny Lee, Ted, Wii
This week I received my most recent purchase from Amazon. (HINT: You can use the link to see some more books I'd love to have... and even buy some for me ). Here's what I bought: Code Complete 2nd edition. With Jeff Atwood advocating it so much, it was not a hard choice. I actually wanted to purchase a book that would generally provide proven practices, and high level overview of programming in a language agnostic way. This seems to be it, and even more. The book is said to be one of all-time-classics of computer...
I'm having a bad day... really. First CC.NET website wouldn't work just when I need it, and now this... How come, when I download Bil Simser's TreeSurgeon, I get empty files in my zip, but when I browse the repository they have some content? Technorati Tags: CodePlex, TreeSurgeon
There's a great talk (video and slides) up on InfoQ, by Dr. Venkat Subramaniam on Agile Practices. Be sure to check it out. Great stuff, great speaker, great author. Technorati Tags: Agile, Practices, InfoQ