Source
- URL: https://x.com/rfleury/status/1561488791503720448
- Author: Ryan Fleury (@rfleury)
- Posted: 2022-08-21 23:01:53
Thread
1/ @rfleury
I have no idea how the idea that data structures are coupled to *layout of data structures in memory * got so pervasive with programmers. It’s like nobody ever learned anything other than malloc’ing each node and stuffing a single tiny payload into them. Totally bizarre.
2/ @plop
@rfleury
well I have an idea, just use c++ 🤷♂️ it’s not like the average person can easily avoid using std containers
3/ @rfleury
@plop
Custom data structures and memory management are not nearly as hard as people make them out to be. In fact, they end up being easier in a lot of ways. I don’t think it’s that difficult to teach, but maybe some good visualizers/debuggers would help make it trivial to understand.
4/ @plop
@rfleury
well I agree we should teach them more, but they do add a lot of potential for bugs, which is why a lot companies/programmers choose to rely on silly but robust std maps instead of writing their own hash maps
5/ @rfleury
@plop
I realize people claim that but it’s never actually measured. In practice it seems entirely false, especially with simple sanity checks and testing. It’s ridiculous, to me, that writing a hash-table is seen as unbearably difficult for professional programmers industry at large.
6/ @rfleury
@plop
Furthermore, this touches on another myth, which is that programmers “choose data structures”. Data structures are not mutually exclusive. When you restrict yourself to choosing one out of a standard library, you eliminate a massive space of possibilities.
7/ @rfleury
@plop
Programmers should instead learn data structure principles and how to mix-and-match them at will.