Live data from Hacker News

Ask HN: Is my software stack choice sound?

news.ycombinator.com

41–49 of 49 posts

Re: Ask HN: Is my software stack choice sound?

#41
post #40

Earlier quoted context omitted.

OK to give you a clear example. Say you have a REST interface for Student and Class. What do you do in rest if you want to get just a class? What do you do if you want to get a class and its students? What do you do if you want to get a Student and also its class? For every iteration of the way you need to access the data you have to modify and extend your REST endpoint or do separate queries. Every time the frontend…

Isn't this exactly what SQL is supposed to be for? Why not just submit SQL queries and get the response directly from the DB? That is to say, what differentiates GraphQL from SQL?

GraphQL is a layer in front of SQL.

I can write a Graphql endpoint in python (Using Django-Graphene). I can write python functions that return data to the graphql. I can write ORM queries that write data to grapqhl. I can specify access, permissions and certain queries based on the user.

Graphql is more of a relational FFI than a SQL replacement.

Also the frontend never sends SQL to get data because it is unsafe. This is what a GraphQL framework allows you to do, clean up and filter queries so they are safe and then translate them into efficient lookups in a RDBMS.

Re: Ask HN: Is my software stack choice sound?

#42
post #22

For new projects, both at work or on the side, I like to imagine I have a “new stuff budget.” That forces me to spend it wisely. If I over-spend my new stuff budget, I take on debt, much like tech debt, that I’ll have to pay down later. I’ll make slower progress because I’m trying to learn too many things at once, and I’ll have to go back and fix suboptimal tradeoffs where I didn’t have enough experience to make the…

AKA innovation tokens

Re: Ask HN: Is my software stack choice sound?

#44
post #40

Earlier quoted context omitted.

OK to give you a clear example. Say you have a REST interface for Student and Class. What do you do in rest if you want to get just a class? What do you do if you want to get a class and its students? What do you do if you want to get a Student and also its class? For every iteration of the way you need to access the data you have to modify and extend your REST endpoint or do separate queries. Every time the frontend…

Isn't this exactly what SQL is supposed to be for? Why not just submit SQL queries and get the response directly from the DB? That is to say, what differentiates GraphQL from SQL?

SQL is a leaky abstraction, which makes your system more brittle. The front-end now has intimate knowledge about the physical data management. You don't want that. If later you decide you want to change your physical data layout to improve data storage and retrieval performance then your queries have to be modified. The front-end and data tier can't vary independently from one another. That's what makes your system brittle.

That's not even getting into the tremendous attack surface you've just opened leaving your application vulnerable to SQL injection attacks. SQL injection is a real problem and scrubbing all the inputs is a pain and you can never be sure you got everything. One mistake and congratulations! - you've made headline news!

These are the problems GraphQL solves.

Re: Ask HN: Is my software stack choice sound?

#45
post #31

Give serious thought about using React Native over Flutter: 1) You can use JavaScript/TypeScript instead of learning another bespoke language (Dart). 2) With React Native you have the option of deploying OTA updates, this allows you to deploy fixes and basic updates without going through the app store review process.

> With React Native you have the option of deploying OTA updates How is this done? Any documentation, tutorial or example that you can point to? > this allows you to deploy fixes and basic updates without going through the app store review process. Does Apple and Google allow this?

They do. With the caveat that only the js bundle can be pushed via ota. If your app changes that touch the native implementation requires a traditional review. Check out Expo publish and Microsoft Codepush.

Re: Ask HN: Is my software stack choice sound?

#46
post #33

Give serious thought about using React Native over Flutter: 1) You can use JavaScript/TypeScript instead of learning another bespoke language (Dart). 2) With React Native you have the option of deploying OTA updates, this allows you to deploy fixes and basic updates without going through the app store review process.

Flutter has hot reload, does React Native?

It does. The react native metro server will watch for file changes and hot reload the javascript bundle.

Re: Ask HN: Is my software stack choice sound?

#47

Earlier quoted context omitted.

What IS GraphQL good for? The only time it seems like it's needed is when you want to ensure your front end devs can work without understanding API code. Am I missing something? P.S. not arguing - genuinely would like to know, since it never clicked. P.S.S. Definitely use Postgres - "When in doubt, Postgres" is a good axiom unless you need something very specific and know what that is. P.S.S.S. Elixir isn't that wide…

GraphQL forms a strongly and deliberately typed interface between a client and server, without frontend and backend teams having to collaborate on the shape of the endpoints (should such and such endpoint gain new options? should it be split into a separate endpoint? should the old one be deprecated, and if so, do clients still rely on it?). Instead, they need only agree on the shape of the data available, and the fr…

* in my experience you basically have to write every call anyway, in other words, getting GraphQL set up on the backend is at least as much work as writing API boilerplate. Again, correct me if I am wrong. It's been a while since I last used GraphQL and I keep hearing about hearing about magic libraries that make it "effortless".

Re: Ask HN: Is my software stack choice sound?

#48

Earlier quoted context omitted.

GraphQL forms a strongly and deliberately typed interface between a client and server, without frontend and backend teams having to collaborate on the shape of the endpoints (should such and such endpoint gain new options? should it be split into a separate endpoint? should the old one be deprecated, and if so, do clients still rely on it?). Instead, they need only agree on the shape of the data available, and the fr…

* in my experience you basically have to write every call anyway, in other words, getting GraphQL set up on the backend is at least as much work as writing API boilerplate. Again, correct me if I am wrong. It's been a while since I last used GraphQL and I keep hearing about hearing about magic libraries that make it "effortless".

I abstain from writing graphql apis now because they’re too much work for me when toy apps are simple and I can render json.

But if a team does want graphql without the fuss of openapi, json schemas, and swagger docs, I recommend tools like Hasura that autogenerates graphql apis over my db. Auto generation of graphql resolvers are the way to go for productivity. Supabase even created a Postgres extension to perform graphql directly within postgres https://supabase.com/blog/2021/12/03/pg-graphql

Re: Ask HN: Is my software stack choice sound?

#49

Earlier quoted context omitted.

* in my experience you basically have to write every call anyway, in other words, getting GraphQL set up on the backend is at least as much work as writing API boilerplate. Again, correct me if I am wrong. It's been a while since I last used GraphQL and I keep hearing about hearing about magic libraries that make it "effortless".

I abstain from writing graphql apis now because they’re too much work for me when toy apps are simple and I can render json. But if a team does want graphql without the fuss of openapi, json schemas, and swagger docs, I recommend tools like Hasura that autogenerates graphql apis over my db. Auto generation of graphql resolvers are the way to go for productivity. Supabase even created a Postgres extension to perform g…

Thanks for the info!
Post reply on HN