4 ms·
So why not just use a map (hash, dict, etc.) instead of an object? You're sending and receiving JSON data, that's maps in maps all the way down. Why this fetish
by anon4 12y ago
So why not just use a map (hash, dict, etc.) instead of an object? You're sending and receiving JSON data, that's maps in maps all the way down. Why this fetish towards mapping your JSON 1:1 to some inner program object?
- lmm 12y agoWell in a real language your objects have guarantees associated with them; constructing them should imply things about their validity. You can draw a distinction between an unvalidated request to construct an object, a valid object, and an update that can apply to an existing object. And your type system lets you ensure that you don't mix them up, that all code paths pass through the assertions you want them to pass through, so you don't do redundant checking and don't worry about missing anything. In go, shrug, hell if I know what anyone's doing with that language.