3 ms·
I understand your reasoning, but in your reply to my critique, you did not address any of the drawbacks I listed except for the first comment I made. If you ca
by jokerx 8y ago
I understand your reasoning, but in your reply to my critique, you did not address any of the drawbacks I listed except for the first comment I made.
If you can explicitly refute those, then your position would be stronger.
- scarface74 8y agoThe programmer must look up that datatype and see oh, it's just an int. And now you need conversion routines or worse yet casting to convert that type to a simple int for interop reasons (database, UI). Why should the developer care what the underlying type is? It should be an opaque type. When you serialize it, your serializer should call your ToString() method. When you deserialize it, your deserializer would call the constructor that takes an int. But why are you saving an id to a database - which would never be used as int - as an int? But even in most CRUD apps, your domain model with rich types would be different than your view model which would probably also be different than your DB model. You are going to be mapping back and forth regardless - hopefully using a tool like Automapper.