I'm learning about DDD, and have come across the statement that "value-objects" should be immutable. I understand that this means that the objects state should not change after it has been created. This is kind of a new way of thinking for me, but it makes sense in many cases.
Ok, so I start creating immutable value-objects.
- I make sure they take the entire state as parameters to the constructor,
- I don't add property setters,
- and make sure no methods are allowed to modify the content (only return new instances).
But now I want to create this value object that will contain 8 different numeric values. If I create a constructor having 8 numeric parameters I feel that it will not be very easy to use, or rather - it will be easy to make a mistake when passing in the numbers. This can't be good design.
So the questions is: Are there any other ways of making my immutable object better.., any magic that can be done in C# to overcome a long parameter list in the constructor? I'm very interested in hearing your ideas..
UPDATE: Before anyone mentions it, one idea has been discussed here: http://stackoverflow.com/questions/263585/immutable-object-pattern-in-c-what-do-you-think
Would be interested in hearing other suggestions or comments though.