This commit is contained in:
Miloslav Ciz 2024-08-04 16:49:53 +02:00
parent 9fc5ae8d5b
commit 275c83d379
27 changed files with 1857 additions and 1819 deletions

2
io.md
View file

@ -12,6 +12,8 @@ This is because **I/O is inevitably messy**: an abstract, portable I/O library r
How to solve this? By separating I/O code from the "pure computation" code, and by minimizing and [abstracting](abstraction.md) the I/O code so that it is easily replaceable. Inexperienced programmers often make the mistake of mixing the pure computation code with I/O code -- it is then very difficult to replace such I/O code with different I/O code on a different platform. See [portability](portability.md) for more detail. Also if you don't have to, **avoid I/O altogether**, especially if your project is a library -- for example if you're writing a 3D rendering library, you do NOT actually need any I/O, your library will simply be computing which pixels to draw and what color they should have, the library doesn't actually have to write those pixels to any screen, this may be left to the user of the library (this is exactly how [small3dlib](small3dlib.md) works).
Also remember the ancient [Unix](unix.md) wisdom: "Text is universal interface".
I/O also poses problems in some programming [paradigms](paradigm.md), e.g. in [functional programming](functional.md).
TODO: code example