r/eli5_programming • u/chidedneck • Nov 23 '19
What is an intuitive explanation of the distinction between “abstract data types” and “data structures”?
I thought they were the same but all the sources I check say there’s a distinction. Yet one site listed queues and stacks as both. Plz halp thx.
5
Upvotes
2
u/Screwedsicle Nov 23 '19
I don't have a good ELI5, but check out the answers here. They helped me: https://softwareengineering.stackexchange.com/questions/148747/abstract-data-type-and-data-structure
2
u/jcodes57 Feb 15 '20
Abstract data types are basically just models describing something with a set of properties (AKA variables) and a set of operations (AKA functions/methods).
You could say that a hypothetical vehicle class you define with a set of properties like numberOfWheels, exteriorColor, etc., and set of operations like drive(), break(), etc. is an Abstract Data Type (ADT).
Data structures are theoretical mechanisms, templates, protocols, or methodologies of storing/sorting/accessing a set of objects (usually ADTs). These data structures have specific characteristics that make them advantageous or less so for different purposes and different situations, but basically all hold data and offer ways of managing critical functions like adding a new entry, removing an old one, searching if an entry exists in the structure, and so on.