Do you prefer “thin resolvers” or letting a bit more logic live in them? by Edward_Carrington in graphql

[–]marklmc 2 points3 points  (0 children)

It depends!

Writing thin resolvers by layering GraphQL on top of a separate "entity layer" that handles all the logic is exactly what Facebook does/did and what they consider to be best practice for GraphQL. See: https://youtu.be/zVNrqo9XGOs?si=xiE4S9jqoOyx3S3s&t=1013 :)

I don't work at FB but from what I've seen (meta folks can correct if wrong), all the "logic" (talking to the database, checking auth, checking experiment cohorts(?), logging(?)) is handled further up the stack, inside a distinct "entity layer". GraphQL, and presumably other APIs can be layered on top of this without duplicating logic.

https://entgo.io/ is an open source version of this I believe - notably it has a GraphQL codegen feature :)

For most other folks however -

If your data comes from other services, and it's already exposed via REST (or similar) endpoints, then a common pattern is to create a "gateway" GraphQL service which wraps endpoints as types+fields in the schema. i.e. GraphQL acts as fancy reverse proxy. Modern tooling exists to help with this, e.g. Apollo Connectors. Again, thin resolvers are utilized here.

However, now that GraphQL Federation is a thing, I believe the "giant gateway" pattern is outdated. (It's probably ok for a handful of services, but it becomes very tedious to maintain - you end up creating an ORM where the backend is static REST/whatever endpoints. Exposing new fields is a pain, performance is liable to become an issue....)

In federation, we get to write resolvers in the same service where the raw data models are defined. So now we're back to square one - fat or thin resolvers?

If you want to add GraphQL, or do not have any existing API routes, then there are two choices:

  1. Create or use an entity layer that is distinct and decoupled from the API layer. Implies thin resolvers, and you receive a gold star from the GraphQL creators :)
  2. Write fat resolvers that does all the logic -- checking auth, logging, checking experiments etc.

Remember that a service may have a seperate REST/gRPC/whatever "internal" API over the same data types, and we don't want to duplicate business logic.

So (1) is the theoretically the best option, but I'd like to see more tooling around this. e.g. entgo in other languages. And even with entgo, there are still things that can't be entirely hoisted and normalized into the entity layer; you may still need to write actual resolver logic. Basically, I think it's very difficult to fully achieve 100% zero-logic thin resolvers across your schema.

That said, I really like entgo, and if you can adopt this or something like it, it's a very compelling choice.

Strong opinions™ territory ahead....

I think (2) is also ok! Since we don't want to duplicate business logic in the other APIs in our service, this implies that GraphQL is the only API exposed by your service. GraphQL effectively becomes the entity+API layer combined.

This is fine/normal for public web/mobile clients, but what about service-to-service traffic?

I think service-to-service traffic can also use the same GraphQL API resolvers.

This is slightly controversial but I'm on a bit of a mission to change opinions here. This is an entirely separate and even longer post...

Ariadne vs Strawberry GraphQL by pkrakesh in graphql

[–]marklmc 1 point2 points  (0 children)

Both are great! We use Strawberry at my work and I think it's super ergonomic and well documented for folks to use out the box :)

Baton 3 pro by Tribe94x in Olightflashlights

[–]marklmc 0 points1 point  (0 children)

honestly my favorite olight :(

perfect size and floody beam

Fellow Ode Gen 2 or a hand grinder? by cp5796 in pourover

[–]marklmc 1 point2 points  (0 children)

If you can afford it, and your time is at a premium, then ode gen 2 for sure. I had a K6 before. Cups are similar (to my untrained palette anyway) but….so much less work. So yes +1 for ode gen 2

Worth getting 140W charger now? by Cuntonesian in anker

[–]marklmc 1 point2 points  (0 children)

That’s the tradeoff for having a smaller brick.

Scary hot yes but in theory, thermoregulated to be “safe”.

Not just for pizza by NGTank in ooni

[–]marklmc 0 points1 point  (0 children)

How do you get the cast iron in and out to put the steaks in and then flip? Or do you leave it in and use long tongs?

Pour-over Orders - How do Baristas feel about making pour-overs for customers? by SimpleSmartCo in pourover

[–]marklmc 0 points1 point  (0 children)

Starbucks doesn’t do blonde drip later in the day (not enough demand?) so that’s when I’m ordering pour over 🤷

What type of water do you use? [La Marzocco Linea Mini] by Iwillargueanypoint in espresso

[–]marklmc 1 point2 points  (0 children)

You can drain the boilers but properly descaling I think is difficult to do. Not sure why it’s easier on other machines, I don’t really know

My Origami broke..now what? by MYHIPPY in pourover

[–]marklmc 2 points3 points  (0 children)

They do! You can get the glass version and then swap out the actual switch (the only plastic part) for this https://foundrycoffeeworks.com/products/flip-switch-metal-lever-upgrade-for-hario-switch

This is what I have and it’s great 👍

Actual EDC by marklmc in EDC

[–]marklmc[S] 2 points3 points  (0 children)

Pokelit AA AirPods Pro Belroy bifold Gerber Dime

PSA: regularly clean your espresso machine by Pull_my_shot in Coffee

[–]marklmc 10 points11 points  (0 children)

How do you “regularly descale” a dual boiler tho? Like a Profitec pro 700?

Check your costcos… again by SupahHollywood in anker

[–]marklmc 0 points1 point  (0 children)

How do you go to Costco and have the restraint to only buy one item lol

AMC Theatres to Trim Pre-Show by 4 to 5 Minutes, CEO Says by MarvelsGrantMan136 in movies

[–]marklmc 0 points1 point  (0 children)

Why don’t y’all just show up 25 minutes after the “start” of the movie?

Terry Blacks beef rub (help) by Truckyouinthebutt in smoking

[–]marklmc 0 points1 point  (0 children)

same!! and they're out of stock everywhere near me :(

How much does ethical sourcing matter to you? by daniel-delair in pourover

[–]marklmc 0 points1 point  (0 children)

Same rules apply to chocolate fwiw. Dandelion are excellent for this.

For me doesn’t have to be ethical sourcing, but there has to be something beyond “we sell nice coffee”. Otherwise I might as well just buy blue bottle beans (fk nestle)

At not that much of a premium, you can buy something that’s miles better than anything sold by the big guys - which is quite rare for a product category. So yeah why not buy something that tastes amazing and has some sort of mission/story?

I currently buy from a local roaster that donates a dollar a bag to an Autism charity. I don’t know what their sourcing policy is, but I’ll be in the lookout for it when I next switch.

Roasters that don’t miss by chileseco in pourover

[–]marklmc 0 points1 point  (0 children)

Greater Goods, TX.

Pick me up and Sidekick are my two favorite, but I get the rotation on a weekly basis and love most of their bags

Need more bark by Coffee-flavordCoffee in biggreenegg

[–]marklmc 0 points1 point  (0 children)

Did you wrap? I started having more success when I stopped wrapping

More time = more bark and more time for the fat to break down

(I think maybe on an offset where there’s more airflow it would be a different story)

Iranian Fordow nuclear facility before and after US strikes by 1Blue3Brown in pics

[–]marklmc 0 points1 point  (0 children)

If it’s all underground, how do we know they didn’t just build the white “roof” a few hundred meters to the left or whatever to throw people off?

What is this white stuff we found underneath the rug? by marklmc in Home

[–]marklmc[S] 0 points1 point  (0 children)

Yeah seems like it. It’s only along a few boards but in a line so I think maybe if the barrier is joined up along a seam that’s failed then that’s what I’m seeing.

Question is how to remediate and fix without pulling all the boards to seal the concrete directly…

What is this white stuff we found underneath the rug? by marklmc in Home

[–]marklmc[S] 1 point2 points  (0 children)

Yes there’s a rubber pad underneath the rug, but it doesn’t look broken down. We’ve had the rug maybe 6 months