👾 Game Player 🎲 Dice Jailor 💻 Functional Typer 📹 Content Creator 🎧 Air Wiggler 🏹 Arrow Shooter ⛔️ Out of Charac

dneaves.com

  • 0 Posts
  • 41 Comments
Joined 3 years ago
cake
Cake day: July 10th, 2023

help-circle

  • I think the shallowness of understanding also stems from the codebase itself, and moreso that than the Ai finding where something is.

    A poorly organized codebase, dynamic file imports lsp’s can’t follow, lack of annotations on unclearly-named arguments, etc. are way worse for understanding a codebase than Ai saying “the thing you need is this method”, which Ai could also explain how it got there at least. At that point, Ai is a better than what they would have without it.

    Write clean, understandable code. Document it, too. Everyone will thank you


  • Tbh, I’d love to be able to use this less for games and more for just Android apps.

    I’d love to move more to a less-Google-owned mobile platform that still has the apps I use and the power to run things. I think the two frontrunners are like /e/OS or GrapheneOS.

    But with Lepton: A) there’s a better chance of the idea of a Linux-non-Android phone, since Lepton could allow Android apps run on a Linux phone; or B) make Linux tablets better, again with Android apps.

    I also have an idea in my head that next “upgrade” I can afford I’ll ditch my phone and go for a smartwatch (with 4G/5G) and a tablet (for apps). The best pairing is probably from Samsung, which unfortunately is both Android/Google and now focused on promoting AI features (ew). I’d go for GrapheneOS if I could put it on a tablet of suitable specs, and if a smartwatch would work well with it (which the watch would probably still be Samsung’s, but maybe RePebble can do something great?).

    But if I could use a Linux tablet? That’s a computer at that point, and I could also benefit from having a laptop since there’s also things an Android device couldn’t do that a computer could (I’m a software dev, it’d be painful on Android). Waydroid/Lepton then supplements the part where there are things Android can do that computers can’t, which is just “apps the developer didn’t make a webapp/computer app for”. Still would have to figure out the watch part, but it’s a start




  • Functional language developers are obsessed with side effects but I rarely ever see problems with it in real code. Like I can remember once in maybe 10 years setting a developer write a “get” method that also wrote to a file. Caught during code review, rewritten easily.

    While, sure, get methods writing files could happen in side-effectful code, the side-effect concern is less about that and more of expectations. With OOP languages, class methods can create a dichotomy of expected returns: Using a list reversal as an example, will a list.reverse(some_list) function reverse the list in-place, or return a copy of the reversed list and leave the original in-tact? To know the answer, you have to check the docs or the type signature (which, yes, is easy, but the answer isn’t obvious). Which, the main concern is trying to debug things “magically changing”, since nested function calls and inherited function calls can modify something from layers upon layers of abstraction away.

    FP languages tend to not have this dichotomy, with very few exceptions like IO in Haskell, ports in Elm and Gren, external functions in Gleam, or FFI in Haskell, to name some ways from languages I know, all of which usually move the control of the program outside the language’s “default area”, anyway. Outside the exceptions, to reverse a list a reverse function needs to be given that list explicitly, and it also will be returning a copy of the list reversed, only and always















  • I find real-world examples help grasp concepts for me. I’ll use an example like a video platform (like Youtube) as an example for this:

    One-to-one: for each one User, you maybe only allow one [content] Channel (or, could be one-or-none, meaning a User may have one Channel, or may use use their User account to be a viewer and have no Channel. You might decide to change this later to be one-to-many, but for the example let’s say you don’t). All the data could be stored just on the User entity, but maybe you decided to separate it into two tables so you don’t need to query the User entity which has sensitive info like a password, email, or physical address, when you just need a Channel. For each Channel, there is a foreign key pointing to the (owning_)user_id, and this is “unique”, so no duplicate id’s can exist in this column.

    One-to-many (or Many-to-one): for each one Channel, there may be many Videos. You could use a relational table (channel_x_video), but this isn’t necessary. You can just store the (owning_)channel_id on the Video, and it will not be unique like the prior example, since a Channel will have many Videos, and many Videos belong to one Channel. The only real difference between “one-to-many” and “many-to-one” is semantic - the direction you look at it.

    Many-to-many: many Users will watch many Videos. Maybe for saving whether a Video was watched by a User, you store it on a table (by the way, this example might not be the best example, but I was struggling to find a good example for many-to-many to fit the theme). Although each video-to-user relation may be one-to-one, many Videos will be watched by one User, and many Users will watch one Video. This would be not possible to store on both the Video or the User tables, so you will need a relational table (video_x_user, or include “watched” in the table name for clarity of purpose). The id column of each row is irrelevant, but each entry will need to store the video_id and the user_id (and neither will be unique), as well as maybe the percent watched as a float, the datetime it was watched, etc. Many-to-many relationships get very complicated often, so should be used carefully, especially when duplicate combinations of a_x_b can occur (here, we shouldn’t store a new row when a user watches a video a second time)