• 4 Posts
  • 15 Comments
Joined 1 year ago
cake
Cake day: October 14th, 2023

help-circle

  • Ok, I’ll just default to flathub for app search instead, thanks.

    Wish I wasn’t already running into bugs with it though - I started installing vscode and logseq with flatpak, it opened them in Mint’s Software Manager and there’s a spinny thing now indicating work is being done, but when I click on it it just says “Currently working on the following packages” and then… nothing, blank screen. No idea if it’s stuck or actually doing something in the background, but it’s been a while (way longer than those would usually require to be installed).

    Not a good first impression for sure
















  • I’m not caching or reusing method results however, and even the inputs are not necessarily cached for multiple uses. I’m just preparing all potentially required input data before the method is actually called so I don’t have to do any loads within the method itself, so the method is just pure code logic and no db interaction.

    For example, imagine you have a method that scores the performance of an athlete. The common “pattern” in this legacy code base is to just go through the logic and make a database load whenever you need something, so maybe at the beginning you load the athlete, then you load his tournament records, then few dozen lines later you load his medical records, then his amateur league matches, etc.

    What I do is I just load all of this into a cache before the actual method call, and then send it into the method as a data source. The method will only use the cache and do all the calculations in-memory, and when it’s done the result would be in the cache as well. Then outside of the method I can just trigger a save or abandon it to persist the result. If I want to unit test it, I can easily just manually fill a cache with my data and use it as the data source (usually you’d have to mock custom response from the repository or something like that, inject an in-memory repository with the same data anyway or just resign to using an integrated test).

    It’s like I’m “containerizing” the method in a way? It’s a pretty simple concept but I’m having trouble googling for it since I don’t know how to call it.