reflections on value objects
Posted: Fri Dec 19, 2008 6:18 am
The following article makes an interesting criticism of C# structs:
The Quest for Quick-and-Easy Immutable Value Objects in C#
In short, the author says that .NET's "value type" abstraction is mostly good, but that C# structs are not the best way to put it in practice. He ends by suggesting a mechanism for defining value objects that would work better that structs.
I think Cobra should go this way, i.e., it should forget about C# style structs (therefore the struct keyword should be dropped) and a more powerful mechanism for defining value objects should be considered. Nemerle has the "Record" macro, which could serve as an inspiration too.
Just an idea, I know there are more urgent issues to address now.
The Quest for Quick-and-Easy Immutable Value Objects in C#
In short, the author says that .NET's "value type" abstraction is mostly good, but that C# structs are not the best way to put it in practice. He ends by suggesting a mechanism for defining value objects that would work better that structs.
I think Cobra should go this way, i.e., it should forget about C# style structs (therefore the struct keyword should be dropped) and a more powerful mechanism for defining value objects should be considered. Nemerle has the "Record" macro, which could serve as an inspiration too.
Just an idea, I know there are more urgent issues to address now.