3 ms·
If you want data abstraction to do at least a minimum of static invariant enforcement, you pretty much have to use abstract data types. But if you're fine with
by catnaroek 9y ago
If you want data abstraction to do at least a minimum of static invariant enforcement, you pretty much have to use abstract data types. But if you're fine with littering logs with “exception was caught here, such and such data structure was corrupted”, suit yourself.
- seanmcdirmid 9y agoIt isn’t that. Abstract data types are designed specifically for data structures like queues and stacks, they don’t make much sense for objects that don’t have such well defined invariants. No major language has adopted them for that reason.
- landryraccoon 9y agoAbstract data types are pretty good if the concrete types are machine generated.
- catnaroek 9y ago> Abstract data types are designed specifically for data structures like queues and stacks Guess what all nontrivial programs manipulate in the end. > objects that don’t have such well defined invariants ... are either stateless or useless. It is impossible to define useful algorithms that manipulate objects of which you cannot say anything. > No major language has adopted them for that reason. The real reason is “programmers cannot reason about invariants anyway”.