Category Archives: Development

Annoyed with INotifyPropertyChanged?

Have you ever been annoyed with having to implement the cumbersome plumbing required for INotifyPropertyChanged ? Well, I have. So I tried to find a way to make authoring bindable objects better. The typical example:

As you can see, it is quite verbose. The event and OnPropertyChanged() method need to be implemented for each […]

Unit testing model validation with MVC’s DataAnnotations

In a previous post, I mentioned that model validation should be tested separately from controller logic. I will demonstrate a way of unit testing the validation of models implemented with System.ComponentModel.DataAnnotations. It is actually quire easy to unit test model validation. Models are inherently easy to test separately due to their POD (Plain Old Data) nature. […]

Unit test equality is not domain equality

I came across a question on stackoverflow concerning comparing object for equality in unit test. The poster basically wants to get rid of series of assertions like this:

I agree, this is ugly. The more so if you have multiple tests that assert on the equality of these properties. You can always factor it […]

Asp.Net MVC: Testing your controller actions

I can’t say I like all the aspects of Microsoft ASP.Net MVC. But there is one aspect that I like though is the ability to unit test most of the components of your application. Standard ASP.Net did not prevent you from testing your application. However, the framework and documentation did not encourage you to organize […]

So what’s wrong with XPathDocument ?

This post is the first in a series of posts related to XPathDocument and XPathNavigator. I will highlight the qualities and drawbacks of the standard .Net implementations and go through the design and development of a new implementation that fits better to my needs. First, what is an XPathDocument ? An XPathDocument is used when you […]

std::unique_ptr semantics

Probably the best feature introduced by C++11 is std::unique_ptr. It will automagically make sure your dynamically allocated objects are deleted when you don’t use them anymore. In previous versions of C++, you needed to rely exclusively on documentation and conventions to ensure dynamically allocated memory was handled properly. With C++11, you can ask the compiler […]

boost::serialization coupling issue

I was evaluating boost::serialization today. Based on the design goals mentioned in the library’s introduction, I felt like boost::serialization would suit my needs. An interesting point is this : 8. Orthogonal specification of class serialization and archive format. That is, any file format should be able to store serialization of any arbitrary set of C++ […]

How to get confused by VC++

Today, I came across a confusing compilation error with MS VC++ using a std::unique_ptr with a custom deleter. Here the code snippet:

The compiler complains : 12345678910111213c:\program files (x86)\microsoft visual studio 10.0\vc\include\memory(2218): error C2338: unique_ptr constructed with null deleter pointer 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\memory(2214) : while compiling class template member function […]