3 ms·
I don't consider TCP an abstraction at all. The abstraction is the unix API over it, and then again, the > ssize_t send (int socket, const void *buffer, size_
by toolslive 2y ago
I don't consider TCP an abstraction at all. The abstraction is the unix API over it, and then again, the
> ssize_t send (int socket, const void *buffer, size_t size, int flags)
is not a nice one. When was the last time you had the data in a buffer, wanted to send it over to the peer at the other side, but didn't mind that it's not sent in it's entirety ? So you have to write a loop over it. Also, is the call blocking or not ? (well, you'll have to read the code that created it to know, so that's no fun neither).
However, it does prove the point the author is trying to make: good abstractions are hard to find!
Anyway, I tried to think of a better example of a good abstraction and found the "Sequence" that's available in plenty of programming languages. You don't need to now what the exact implementation is (is it a list, a tree, don't care!) to be able to use it. Other example I found were Monoid and Monad, but that's tied to the functional paradigm so you lose most of the audience.