2.6 KiB
title, type, source, source_url, author, handle, post_id, date, archived, draft, tags, description, in_reply_to
| title | type | source | source_url | author | handle | post_id | date | archived | draft | tags | description | in_reply_to | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| I have no idea how the idea that *data structures* are coupled to *layout of data structures in memory * got so pervasive with programmers. | archive | https://x.com/rfleury/status/1561488791503720448 | Ryan Fleury | rfleury | 1561488791503720448 | 2022-08-21 | 2026-08-27 | false |
|
I have no idea how the idea that *data structures* are coupled to *layout of data structures in memory * got so pervasive with programmers. |
Source
- URL: https://x.com/rfleury/status/1561488791503720448
- Author: Ryan Fleury (@rfleury)
- Posted: 2022-08-21 23:01:53
Thread
1/ @rfleury ^1561488791503720448
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 ^1561711055285456897
@rfleury
well I have an idea, just use c++ 🤷♂️ it's not like the average person can easily avoid using std containers
3/ @rfleury ^1561720380590419968
@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 ^1561752840330219521
@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 ^1561755261567508486
@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 ^1561755644868251648
@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 ^1561755778175815680
@plop
Programmers should instead learn data structure principles and how to mix-and-match them at will.