3 ms·
>For example, say you have an object that holds some strings and numbers and it has getters and setters on it. How is that different than a Hash? Of course thi
by hackinthebochs 14y ago
>For example, say you have an object that holds some strings and numbers and it has getters and setters on it. How is that different than a Hash?
Of course this is the most degenerate case of an object, so pointing to this as an counter-argument to OOP seems rather specious. The typical case is that the data being encapsulated is related to each other in some way, and thus having a restricted set of operations on the object can ensure certain invariants are maintained. You cannot duplicate this with just a standard hash.
>and inheritance lets humans do what they love to do - name and categorize things.
You say that like its a bad thing. If humans like to categorize, why shouldn't our programming languages be designed around this tendency?
- gridaphobe 14y ago> You say that like its a bad thing. If humans like to categorize, why shouldn't our programming languages be designed around this tendency? I've always had the impression that we (at least as programmers) are incredibly bad at categorizing things into hierarchies. I think class hierarchies (and module hierarchies for that matter) suffer from a similar problem to that of hierarchical file systems, there is often more than one way of organizing the items and it's unclear which way is right. I'd like to see if one could use a tagging mechanism instead; I guess interfaces/mixins/traits could be thought of as tags for classes though.
- ionforce 14y agoIsn't that what interfaces are?