4 ms·
It's frustrating to read this thread and your comment kind of crystallized this for me so I'll respond to you. Using an array without having to (manually) calc
by Misdicorl 8y ago
It's frustrating to read this thread and your comment kind of crystallized this for me so I'll respond to you.
Using an array without having to (manually) calculate the size of the objects contained within is like the major triumph of OO. This is a getter that you almost certainly use constantly.
Please try to consider your statements and potential counter factuals before spraying nonsense into the void
- patrec 8y ago> Using an array without having to (manually) calculate the size of the objects contained within is like the major triumph of OO. I've used arrays in countless OO and non-OO programming languages, and I do not recall ever having to manually calculate the size of objects contained therein – what are you talking about? Only C requires crap like that, but precisely because it doesn't have first class arrays.
- Ma8ee 8y agoWatch your tone!
- weberc2 8y ago> Please try to consider your statements and potential counter factuals before spraying nonsense into the void My claim was that getter abstractions as described by the GP (abstracting over the “accessed from memory” implementation detail) are not useful. Why do you imagine that your array length example is a reasonable rebuttal?
- Misdicorl 8y agoIts not the length of the array. Its using things like array[20]. Yes that exists pre-OO and outside of OO, but its the foundational aspect of OO and one of the strongest use cases. Sorry for the way I communicated- I was tired and should have reconsidered.
- weberc2 8y ago> Sorry for the way I communicated- I was tired and should have reconsidered. No worries, it happens. :) > Its not the length of the array. Its using things like array[20]. Yes that exists pre-OO and outside of OO, but its the foundational aspect of OO and one of the strongest use cases. I'm not sure what you're getting at then. Indexing into an array? Are you making a more general point than arrays? I'm not following at all, I'm afraid.
- Misdicorl 8y agoI think my argument is basically that arrays are effectively object oriented abstractions in most languages. You aren't responsible for maintaining any of the internal details, it just works like you want it to. My example was with the getter for the item at index 21 (since you had specifically called out useless getters), but equally well applies to inserting, deleting, capacity changes, etc.
- weberc2 8y ago> I think my argument is basically that arrays are effectively object oriented abstractions in most languages. I think I see what you mean, although I think it's worth being precise here--arrays can be operated on via functions/methods. This isn't special to OO; you can do the same in C (the reason it's tedious in C is that it lacks generics, not because it lacks some OO feature) or Go or Rust or lisp. These functions aren't even abstractions, but rather they're concrete implementations; however, they can implement abstractions as evidenced by Java's `ArrayList<T> implements List<T>`. And to the extent that an abstract container item access is a "getter", you're right that it's a useful abstraction; however, I don't think that's what most people think of when they think of "getter" and it falls outside the intended scope of my original claim.
- dragonwriter 8y ago> Using an array without having to (manually) calculate the size of the objects contained within is like the major triumph of OO. Er, aside from C and ASM, few non-OO languages require that kind of manual effort. That's not a triumph of OO, it's a triumph of using just about any language that has an approach to memory management above the level of assembly.