News for hackers. Stuff that matters.
Re:A Sketch of the Biggest Idea in Software Architecture (2022) by rwmj on Monday April 22, 2024 @07:29AM (#40113286)
I first heard about this concept in the early 1990s from netpbm (then called pbmtools). The exact language seems to have been removed from the current manual[1] but the basic idea was that if you have N image formats, you can either write NxN tools to convert between them, or you can have a few common image formats (ie. pbm - bitmap, pgm - greyscale and ppm - fullcolour) and then write 2xN tools to convert between the universe of all image formats and the common formats. You then use Unix pipes to connect the tools together.

[1] https://netpbm.sourceforge.net/doc/

Re:A Sketch of the Biggest Idea in Software Architecture (2022) by nottorp on Monday April 22, 2024 @09:22AM (#40114101)
Except in that case you're converting to and from an uncompressed buffer... that could be in ram and not use a file format at all?
Re:A Sketch of the Biggest Idea in Software Architecture (2022) by rwmj on Monday April 22, 2024 @10:03AM (#40114497)
It's much more useful to have a real file format.

For example, you can generate images from your own code by doing this (with a bit more shell quoting and error checking in the real code):

  fp = popen ("ppmtojpeg > output.jpg", "w");
  fprintf (fp, "P3 1024 1024 255\n");
  for (y = 0; y < 1024; ++y)
    for (x = 0; x < 1024; ++x)
      fprintf (fp, "%d %d %d\n", 255*r[y][x], 255*g[y][x], 255*b[y][x]);
  fclose (fp);
Re:A Sketch of the Biggest Idea in Software Architecture (2022) by frutiger on Monday April 22, 2024 @01:44PM (#40116748)
This is the first time I have seen anyone popen’ing a pipeline like that, and writing to its stdin.

Bravo.

Re:A Sketch of the Biggest Idea in Software Architecture (2022) by ramses0 on Monday April 22, 2024 @01:53PM (#40116850)
I miss a bit some of the old `xxx2yyy` programs. It's tempting to consider:

     FILE.csv.html.pdf.zip
...`csv2html | html2pdf | pdf2zip`, and vice-versa... how possible is it to make the pipeline reversible, eg: `zip2pdf | pdf2html | html2csv`, or in the absence of "reversibility", could you simply shortcut and get straight back to the original `*.csv`?