YAML and TOML suck. Long live the FAMF!

        • Ferk@programming.dev
          link
          fedilink
          arrow-up
          3
          ·
          edit-2
          4 months ago

          For the record, you mention “the limitations of the number of inodes in Unix-like systems”, but this is not a limit in Unix, but a limit in filesystem formats (which also extends to Windows and other systems).

          So it depends more on what the filesystem is rather than the OS. A FAT32 partition can only hold 65,535 files (2^16), but both ext4 and NTFS can have up to 4,294,967,295 (2^32). If using Btrfs then it jumps to 18,446,744,073,709,551,615 (2^64).

        • Perma@programming.devOP
          link
          fedilink
          arrow-up
          1
          ·
          4 months ago

          Well I’d you have so many data entry, yaml and toml are not that helpful either. They would present different sets of problems. You should use a database (perhaps sqlite) for that purpose.

  • Hawk@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    9
    ·
    4 months ago

    This post misses the entire point of JSON/TOML/YAML and the big advantage it has over databases: readability.

    Using a file based approach sounds horrible. Context gets lost very easily, as I need to browse and match outputs of a ton of files to get the full picture, where the traditional methods allow me to see that nearly instantly.

    I also chuckled at the exact, horribly confusing example you give: upd_at. A metadata file for an object that already inherently has that metadata. It’s metadata on top of metadata, which makes it all the more confusing what the actual truth for the object is.

    • Perma@programming.devOP
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      I know! right?

      Some say thay since you can use ‘tree’ and things like ranger to navigate the files, it should work alright. But I guess if you have one giant metadatafile for all the posts on your blog, it should be much easier to see the whole picture.

      As for upd_at, it does not contain information about when the files have been edited, but when the content of the post was meaningfully edited.

      So if for example I change the formatting of my times form ISO3339 to another standard, it changes the file metadata, but it does not update the post content, as far as the readers of the blog are concerned with. But I get why you chuckled.

      • netvor@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        3 months ago

        Tip: find -type f | xargs head (but no it’s not comfy)

        but I don’t think going to “one giant metadatafile” argument helps; personally my attention starts splintering far sooner than that. Most of the time, if I’m looking at meta-data of an object, I’m not just looking at that single object, I’m reasoning about it in relation to other data points (maybe other objects in the same collection, maybe not). If at some point I want to shift my focus from created_at to updated_at or back, I need that transition to be as cheap as eye saccade. So by splitting the data to multiple files you are sort of setting “minimal tax” already pretty high.

        That said, for simple projects where you want to have as few dependencies as possible, I think it’s fine; it might or might not be better than raw-dogging your own format. I’ve actually implemented pretty much this format multiple times when I was coding predominantly in Bash. (Heck, eg. my JATS framework is pretty much using FAMF for test run state 😄 .) Just be careful: creating / removing files and directories can be a pretty risky operation – make a typo in (or fail refactoring) a shell variable and you might be just rm -rf’ing your own “$HOME”. It might be one of things you want to do less of, not more.

        BTW, I chuckled because you turn from created_at to cre_at for no apparent reason. (I mean, if you like obscure variable names, fine by me, but then why would you call it created_at in the first file?)

        BTWBTW, I love your site, I wish most of the web looked like that; the grey gives me sort of nostalgy :D Also you reminded me that I should give Kagi a try…

  • JackbyDev@programming.dev
    link
    fedilink
    English
    arrow-up
    6
    ·
    4 months ago

    It’s a very interesting idea. I don’t think I’ll use it and I think the downsides outweigh the benefits but it is still an interesting idea.

    In all of these cases, the answer is not TOML, YAML or JSON — or FAMF for what it’s worth. It is goddamn database.

    I was about to boo and hiss, but if you mean something like sqlite as an application file format I’m more tempted to agree.

    • Perma@programming.devOP
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      Well, I mostly target the places where you don’t programmatically generate millions of values. Configurations, entry metadata, etc. Indeed SQLite is much better for when you have a massive amount of data, and you need a better base that a file system. But when that is not the case, a file system is more advanced than whatever tooling are behind toml and yaml.

  • Kissaki@programming.dev
    link
    fedilink
    English
    arrow-up
    2
    ·
    4 months ago

    You can easily parse this using awk, sed, fzf,

    Well… I would know how to do it easily in C# or Nushell. But those tools? Maybe it’s easy when you’re already intuitively familiar with them. But line/string splitting seems anything but with complex utils like that with many params and a custom syntax.

    • Ferk@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      4 months ago

      That quote was in the context of simply separating values with newlines (and the list also included “your language’s split or lines function”).

      Technically you don’t even need awk/sed/fzf, just a loop in bash doing read would allow you to parse the input one line at a time.

      while read line; do 
         echo $line # or whatever other operation
      done < whateverfile
      

      Also, those manpages are a lot less complex than the documentation for C# or Nushell (or bash itself), although maybe working with C#/nushell/bash is “easy when you’re already intuitively familiar with them”. I think the point was precisely the fact that doing that is easy in many different contexts because it’s a relatively simple way to separate values.

      • Kissaki@programming.dev
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 months ago

        Yeah, I see they did mention “your languages functions”. It’s just, subjectively, reading awk and sed next to “easily” irritates me. Because I’ve never found it easy to get into those.

        • Perma@programming.devOP
          link
          fedilink
          arrow-up
          1
          ·
          4 months ago

          Sure. You should use whatever you are comfortable with. That’s the point. When you don’t need special parsers or tools, you can more easily adopt your tooling for the job, because almost every language has tools to deal with files. ( I assume there is some language that doesn’t, who knows?)

  • Rogue@feddit.uk
    link
    fedilink
    arrow-up
    2
    ·
    4 months ago

    I actually quite like this idea.

    You can take it a step further and use file extensions to determine the format. For example the parser would first search for title, and if it doesn’t exist try title.md title.html etc and render the content appropriately.

  • Kissaki@programming.dev
    link
    fedilink
    English
    arrow-up
    2
    ·
    4 months ago

    Fully committed to directory file structure. Except for value lists. Those are text files you have to parse anyway.

  • Joël de Bruijn@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    4 months ago

    I like this … a lot.

    Is it new?

    If there isn’t even a todo task manager that handles notes this way, it is. Because man are there myriad implementations of that stuff.

    • Joël de Bruijn@lemmy.ml
      link
      fedilink
      arrow-up
      2
      ·
      4 months ago

      And like you said: all tooling for files works for this … For example I use F2 (highly recommended btw) for bulk editing filenames based on regex patterns. This could easily used to edit metadata in bulk.

      • Perma@programming.devOP
        link
        fedilink
        arrow-up
        2
        ·
        4 months ago

        Oh goody! F2 is great, but the developers are craaazy! They packages commandline Go application with npm!

        I also like vimv and vidir for simpler stuff.

  • mvirts@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    4 months ago

    I think a more clear name for this would be “filesystem data structures” since the key idea is editing structured data through the filesystem. I can imagine a FUSE driver that can map many types of data to this structure.

    • Ferk@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      4 months ago

      Yes… “metadata” is becoming an overused term. Not all data is metadata.

      My first thought when I read the title was about those .nfo files used by Kodi/Jellyfin and other media centers to keep information relative to the media files.

    • Perma@programming.devOP
      link
      fedilink
      arrow-up
      3
      ·
      4 months ago

      Yes. That is indeed a more interesting name. But think of the acronym.

      • FDS is not as easy to say FAMF.
      • FAMF already has an Urban Dictionary entry.
  • Kissaki@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    4 months ago

    My biggest issue is with how spread out the information will be. You need something other than your standard file and directory explorers. Because you want to see and work with a view across multiple levels of directories and files and their content.

    • Perma@programming.devOP
      link
      fedilink
      arrow-up
      2
      ·
      4 months ago

      Definitely. But you would need need something other than those for the working with 100 json files as well. The question is, which kinds of things you would like to have as extra. You can go with jq and prettier syntax highlighting or you can go with tree and cat (and dog). It is the matter of taste. But also, I am always right, because my mom told me I am special .