• Activity
  • Votes
  • Comments
  • New
  • All activity
    1. Ask Tildes: Design practices for retrieving dozens (or hundreds) of related records over a RESTful API

      I'm looking for some feedback on a feasible mechanism for structuring a few API endpoints where a purely RFC-spec compliant REST API wouldn't suffice. I have an endpoint which returns $child...

      I'm looking for some feedback on a feasible mechanism for structuring a few API endpoints where a purely RFC-spec compliant REST API wouldn't suffice.

      I have an endpoint which returns $child entries for a $parent resource, let's call it: /api/parent/:parentId/children. There could be anywhere from a dozen to several hundred children returned from this call. From here, a child entity is related to a single userOrganization, which itself is a pivoting entity on a single user. The relationship between a child and user is not strictly transitive, but can each child only has one userOrganization which only has one user, so it is trivial to reach a user from a child resource.

      Given this, the data I need for the particular request involves retrieving all user's for a parent. The obvious, and incorrect solution to the problem is to make the request mentioned above, and then iterate through and make an API request to retrieve each user. This is less than very good as this would obviously be up to several hundred API calls.

      There's a few more scalable solutions that could solve this problem, so any input on these ideas is great; but if you have a better proposal that also works, I'm keen to explore that!

      Include user relationships in the call by default.

      This certainly does solve the problem, but it's also pumping down a load of data I don't necessarily need. This would probably 2x the amount of bytes travelling along the wire, and in 8 out of 10 calls, that extra data isn't needed.

      Have a separate /api/parent/:parentId/users call.

      Another option that partially solves the issue: I need data from both the child and the user to format this view, so I'd still need to make the initial call I documented earlier. Semantically, it feels a bit odd to have this as a resource because I don't consider a user to be nested under a parent in terms of database topology.

      Keep the original call, but add a query parameter to fetch the extra data

      This comes across as the 'least worst' idea objectively, in terms of flexibility and design. Through the addition of the query parameter, you could optionally retrieve the relationship's data. This seems brittle and doesn't scale well to other endpoints where it could be useful though.

      Utilize a Stripe expands-style query parameter.

      Stripe implements the ability to retrieve all related records from an API endpoint by specifying the relations as strings. This is essentially the same as the above answer, but is scaled to all available API endpoints. I love this idea, but implementing it in a secure way seems fraught with disaster. For example, this is a multi-tenancied application, and it would be trivial to request userOrganization.user.organizations.users. This would retrieve all other organisations for the user, and their users! This is because my implementation of expands simply utilises the ORM of my choice to perform a database join, and of course the database has no knowledge about application tenancy!


      Now, I do realise this problem could easily be solved by implementing a GraphQL API server, which I have done in the past, but unfortunately time and workload constraints dictate implementing a GraphQL-based solution is infeasible. As much as I like GraphQL, I'm not as proficient in that area as compared to implementing high quality traditional APIs, and the applications I'm working on at the moment are focusing on choosing boring technology, and not using excessive innovation tokens.

      Furthermore, I do consider the conceptuals around REST APIs to be more of an aspirational sliding scale, rather than a well defined physical entity, because let's face it, the majority of popular APIs today aren't REST-compliant, even Stripe's isn't, and it's usually both financially healthier and feature-rich to choose a development path that results in a rough product that can be refined later, than aiming for a perfect initial release. All this said, I don't mind proposals or solutions to my problem that are "good enough". As long as they aren't too hacky! :)

      10 votes
    2. How to best utilise 5k GBP

      Hey everyone, as a goal for this coming year I’d like to better put to use the small amount of savings I have. My first idea is: 3k emergency fund in a NS&I Government insured account. 2k in a...

      Hey everyone, as a goal for this coming year I’d like to better put to use the small amount of savings I have.

      My first idea is:

      • 3k emergency fund in a NS&I Government insured account.
      • 2k in a Vanguard index fund.

      A few questions:

      1. Is this sort of setup the best use for such a sum?

      2. If so, with the impending brexit, does it makes sense to move the money out of the U.K?

      3. Is there much maintenance with an index fund or is it sufficient to let the money sit? I’m aware anything of this nature is essentially a gamble.

      4. How do you calculate a worthwhile amount to invest considering the on-running service costs?

      5. Does anyone have experience with ethical index funds? If so which? And how have they performed for you?

      Any help is most appreciated.

      11 votes
    3. Top Movies of the 2010s

      The end of the year has me in a movie-watching mood and I want to add the best of the best into my queue for the next few weeks. Similar to games of the decades, what are your movies of the...

      The end of the year has me in a movie-watching mood and I want to add the best of the best into my queue for the next few weeks. Similar to games of the decades, what are your movies of the decades and why?

      22 votes
    4. Don't trust online reviews (personal anecdote)

      I recently bought a product online. I wasn't able to find it in a bricks-and-mortar shop, so I had to buy it online to even see it, let alone try it. I received it, and it wasn't right for me. I...

      I recently bought a product online. I wasn't able to find it in a bricks-and-mortar shop, so I had to buy it online to even see it, let alone try it. I received it, and it wasn't right for me. I was able to exchange it for a different version, but even the different version wasn't right. So I returned the product and got a refund. All along, the customer service was excellent, but the product itself turned out not to be what I wanted.

      The way the product failed for me was connected to the "headline" description of the product. It wasn't a minor failure. It did something that they explicitly said it wouldn't do, which was one of the main selling features of the product.

      After the dust settled, I wrote a review of the product. I don't normally do this: I neither write nor read reviews. However, I know that other people do rely on reviews and, seeing as this product is only available online, and its failure was linked to a major selling feature of the product, I felt duty-bound to inform other prospective buyers that it might not suit some people. I gave it a 2-star (out of 5) rating, as well as writing up why it didn't suit me (while allowing that it might still suit other people).

      Since I submitted the review, I have checked the website (I'm an egotist: I wanted to see my words being published!). Other reviews with more recent timestamps have appeared, but my review has not appeared. I've now noticed that the lowest rating in their reviews is a single 3-star rating, with some 4-star reviews and lots of 5-star reviews. There are no 2-star or 1-star reviews. My only conclusion is that the company selects which reviews to publish - and which ones not to publish.

      I've always wondered if companies would post negative reviews of their own products. Now I know for sure that at least one company does not.

      18 votes
    5. Happy 2020 everyone!

      I’m a bit tipsy, but I sincerely mean this to you all: I wish you a prosperous year and decade. This site has been an encouraging sign the last year - May it last ever on! I wish a peaceful and...

      I’m a bit tipsy, but I sincerely mean this to you all:

      I wish you a prosperous year and decade. This site has been an encouraging sign the last year - May it last ever on!

      I wish a peaceful and prosperous new year on all :)

      44 votes
    6. What are some games like VA-11 HALL-A and Read Only Memories : 2064?

      I played VA-11 HALL-A quite a while ago and recently played ROM 2064. Both have similar aesthetics, sound, themes although they have different mechanics. I really liked how ROM had voice acting...

      I played VA-11 HALL-A quite a while ago and recently played ROM 2064. Both have similar aesthetics, sound, themes although they have different mechanics. I really liked how ROM had voice acting too which is a shame to say is not the case of VA-11 HALL-A but I still quite enjoyed both. 2064 perhaps more since it felt more engaged but perhaps that's just memory tricking me.

      I know there's N1RV Ann-A and ROM Neurodriver coming in 2020 but well, after that, I'll still have nothing so, what games have you played which are similar?

      PS : Have a happy new year and hope I've not posted in the wrong place, I'm not sure if it would've fit in the recurring topic.

      9 votes
    7. Ability to hide posts that link to specific websites

      I'd be interested in a feature where I can have a list of top-level domains that I want to ignore content from. For example, I'm never in a position to watch a video when I'm browsing tildes. So...

      I'd be interested in a feature where I can have a list of top-level domains that I want to ignore content from. For example, I'm never in a position to watch a video when I'm browsing tildes. So I'd like the option to just not see any link to youtube.com or vimeo.com. Maybe I think all content posted to example.com is inflammatory click-bait, so I just want to ignore those links, too.

      Would that be possible?

      11 votes
    8. When was the first time you felt different?

      All of us know the feeling; some of us have felt it more intensely than others; some of us have to continue to live with it daily. When was the first time you really became aware of it? What did...

      All of us know the feeling; some of us have felt it more intensely than others; some of us have to continue to live with it daily.

      When was the first time you really became aware of it? What did it feel like? How did it play out?

      30 votes
    9. Explanatory narratives - tell your stories!

      I've commented on explanatory frameworks before. These are the unifying narratives that we use to make sense of ourselves, political concerns, economics, and even science and mathematics....

      I've commented on explanatory frameworks before. These are the unifying narratives that we use to make sense of ourselves, political concerns, economics, and even science and mathematics. Narratives are accounts of connected events or phenomena that attempt to express the connections in an explanatory story.

      We're often afflicted with "just-so" narratives that attempt to reconcile or explain the way the world works with little or no evidence, like claiming inequality of inborn capacities, innate racial differences, or the intervention of supernatural entities and forces.

      So this is everyone's chance to tell a story, at whatever length they find convenient, which explains something that concerns them. Possible examples of story topics:

      "Why finding work is a struggle for me"
      "Bayes' Theorem accounts for everything"
      "Political parties can't handle reality"

      These examples aren't about me or my beliefs - I'm just flinging things out there. This also isn't a college narrative essay exercise. So just tell a good story about something you care about, that's likely to engage others' interests and concerns.

      Conspiracy theories are probably not a good idea here; the tendency towards them is a dysfunction of humans' ability to create, and desire for, narratives.

      I ask that participants in the thread refrain from attempting to argue with or disprove others' stories here, but they can become jumping-off points for new Tildes topics.

      If this exercise is well-received, it could become a monthly recurring thread. Feel free to advise on better structure.

      17 votes
    10. Fitness Weekly Discussion

      What have you been doing lately for your own fitness? Try out any new programs or exercises? Have any questions for others about your training? Want to vent about poor behavior in the gym? Started...

      What have you been doing lately for your own fitness? Try out any new programs or exercises? Have any questions for others about your training? Want to vent about poor behavior in the gym? Started a new diet or have a new recipe you want to share? Anything else health and wellness related?

      7 votes
    11. Super totally official Happy New Year thread

      Happy 2020 Tildes people! Here's to good health, personal growth, and much success to each and all of you in the new year. It's always a good time to remember we have the power to shape our lives...

      Happy 2020 Tildes people! Here's to good health, personal growth, and much success to each and all of you in the new year. It's always a good time to remember we have the power to shape our lives however we want them to be. Peace and blessings.

      22 votes
    12. My 2020 Book Challenge: "Reading the Alphabet"

      Here's a little setup I'm going to try out with my reading habits this year. I figured I'd share the idea, in case anyone else is interested in running it (or something similar) for themselves....

      Here's a little setup I'm going to try out with my reading habits this year. I figured I'd share the idea, in case anyone else is interested in running it (or something similar) for themselves.

      Rules

      • I must complete one book for each letter of the English alphabet (26 total).
      • A book fulfills a letter by having the title or any part of the author's name start with that letter.
      • I do not have to go in alphabetical order.
      • I CAN rearrange entries at will.

      Example

      I realize that's hard to visualize, so here's how the first few letters might look once completed (these books are placeholders):

      A: Jeff VanderMeer - Annihilation
      B: Tina Fey - Bossypants
      C: Arthur C. Clarke - Rendezvous with Rama
      D: Dava Sobel - Longitude

      Explanations/Clarifications

      Let's say the first book I read is Kurt Vonnegut's Slaughterhouse-Five. I could have that count for K (Kurt), V (Vonnegut), or S (Slaughterhouse).

      I'm choosing to ignore articles in titles. The Martian would thus count for M (Martian) rather than T (The).

      If an author has a single name (e.g. Voltaire), I can only use that one letter (V). If an author commonly uses more than first and last names (e.g. Chimamanda Ngozi Adichie, Hunter S. Thompson), I can use any parts (C N or A, and H S or T, respectively).

      If the book title is/begins with a number or symbol, I can count it under the letter that corresponds to the name/pronunciation of the number or symbol (e.g. 1984 would be N (Nineteen) while 1Q84 would be O (One)).

      As the process goes on and more letters get filled, my choices will get narrower. I am allowed to swap around books in order to accommodate new choices, but only within the parameters of the rules above. So if I initially had Kurt Vonnegut's Slaughterhouse-Five down for S but then I decide to read Stanley Schmidt's The Sins of the Fathers, I can move Slaughterhouse-Five to V for Vonnegut since Sins can only work for S.

      Purpose

      I came up with this for a couple of reasons:

      • It's a semi-fun way to jazz up my regular reading habits.
      • It gives me a goal to work towards.
      • It will help me narrow down choices from my immense backlog and interest list, especially when I have only a few spots left to fill.
      • It's free-form enough that I don't feel boxed-in, but it's restrictive enough that it'll likely force me to read some stuff I wouldn't usually choose.
      • 26 books for 26 letters is coincidentally perfect for an average of one book every two weeks, which feels like the right pace for me.

      Process Note

      I'm only going to count books I read with my eyes rather than books I listen to. This isn't because I have anything against audiobooks (I love them!) but because I've actually gotten TOO dependent on them and am not sitting down to read books like I used to. I'm hoping this can restart my reading habit. I put this here rather than in the rules because I don't want to restrict anyone else should they choose to do this exercise.


      I plan to post updates on my "alphabet progress" in the scheduled "What are you reading these days?" threads.

      Anyway, feel free to share your thoughts on this process. This is entirely theory-based at the moment, as I've never actually attempted it, so if there's anything I've failed to account for or any potential hiccups you see, let me know.

      Also, if you're wanting to steal the idea, whether wholesale or in part, go for it! It is ripe for modding or tweaking. I'm considering doing a second, separate alphabet for myself that's limited only to graphic novels, for example. I also think it would be neat for people to do it in other alphabets, in languages other than English.

      Furthermore, it's a generic enough setup that you could do it for more than just reading too. You could use the ruleset as written with music (using artist and album names) or movies (using titles and directors). Games are a bit tougher since you really only have the title to work with (since there's often not an identifiable "author"), but with some tweaks I think it could still happen.

      10 votes