djtaylor.me

Insert tagline here
BlogThoughtsProjectsResumePhysics

Abstractions are logarithms

Pub. 2023 Sep 6

Say you have some piece of software that reads PNG files from disk and displays them on the screen with X11. It was a pain to get it working properly, but it's finished. But now you want to support Win32 and Cocoa and JPEGs and GIFs! Pretty soon you have 9 pieces of code for displaying images:

Of course, you could have also abstracted away the file and operating system specifics. We could write our software in such a way that it always converts images to a common simple file format, like RGB8. Then the appropriate operating system specific code reads from that common buffer in its own specific way.

With this, there are only 6 piece of code:

Abstractions turn multiplications (3 * 3 = 9) into additions (3 + 3 = 6). Abstractions are logarithms.

Written by Daniel Taylor.
Email: contact@djtaylor.me

© 2024 by Daniel Taylor