Live data from Hacker News

What I wish I knew before building a Shopify App

ma.ttias.ch

111–120 of 175 posts

Re: What I wish I knew before building a Shopify App

#111
post #76

Earlier quoted context omitted.

> `import shopify` makes an API request. Especially for a company that prides itself on great API design, this is head scratching. ‘shopify.Init()’ seems like such an obvious solution

The fact that you can have side effects on imports, and that a lot of libraries relied on side effects on import, was one of my biggest sources of frustration with Python

What other packages have you seen abusing import side effects?

Shopify is the first one I've seen, so I don't think it's quite as common as you are implying, but I'm curious to know what other bad behavior you have found

Re: What I wish I knew before building a Shopify App

#113

In support of the platform: * I've never had zero options for solving a problem. Ten years ago, I needed to build a customer login system on top of Shopify. (Like, before Shopify had one of its own.) I had enough room to do that in javascript, and it became an app called Gatekeeper. (Today's spiritual successor: Locksmith.) * Whoever works on patterns at Shopify does a really, really good job. They think through thin…

Ah, I was going to build an app just like that! Guess not, anymore. Looks like you took a cool idea and did an awesome job of executing of it!

Re: What I wish I knew before building a Shopify App

#115
post #98
post #95

Earlier quoted context omitted.

I don't really understand why developers use SDKs/libraries at all when the RESTful APIs are easy enough to consume directly.

Handroll marshalling for every payload, handle the auth sequence, check arguments, endpoint semantics, sort out sparse versus full entity patching mismatch, build in retry that matches status codes, and do this for every endpoint. If you're moving fast, you don't have time for this. Especially if it isn't your core competency / core product.

Depends to be honest. Where they expose OpenAPI docs it's dead simple to generate the models from that. In .NET I use those plus Refit and boom. Now I have full control and it took barely any time.

Re: What I wish I knew before building a Shopify App

#116
post #98
post #95

Earlier quoted context omitted.

I don't really understand why developers use SDKs/libraries at all when the RESTful APIs are easy enough to consume directly.

Handroll marshalling for every payload, handle the auth sequence, check arguments, endpoint semantics, sort out sparse versus full entity patching mismatch, build in retry that matches status codes, and do this for every endpoint. If you're moving fast, you don't have time for this. Especially if it isn't your core competency / core product.

Most APIs there's usually only a handful of endpoints. There's never an auth sequence, just a simple API key. Patching is exceedingly rare. I don't want an SDK to auto-retry. Interacting with an API actually usually is or needs to be a core competency.

I still think the major promise of RESTful APIs is avoided by the prevalence of SDKs.

Re: What I wish I knew before building a Shopify App

#117
post #98

Earlier quoted context omitted.

Handroll marshalling for every payload, handle the auth sequence, check arguments, endpoint semantics, sort out sparse versus full entity patching mismatch, build in retry that matches status codes, and do this for every endpoint. If you're moving fast, you don't have time for this. Especially if it isn't your core competency / core product.

Depends to be honest. Where they expose OpenAPI docs it's dead simple to generate the models from that. In .NET I use those plus Refit and boom. Now I have full control and it took barely any time.

I like this approach too, but a non trivial amount of time the models come out wrong. I assume this is because of bad openapi docs, but maybe I'm wrong.

What do you use to consume the openapi docs and generate models with?

Re: What I wish I knew before building a Shopify App

#118
post #76

Earlier quoted context omitted.

The fact that you can have side effects on imports, and that a lot of libraries relied on side effects on import, was one of my biggest sources of frustration with Python

What other packages have you seen abusing import side effects? Shopify is the first one I've seen, so I don't think it's quite as common as you are implying, but I'm curious to know what other bad behavior you have found

Not GP but I've been bitten by plenty of first-party implicit side-effects, both intended (by not me not now) and not (by me or otherwise).

Re: What I wish I knew before building a Shopify App

#119
post #66

Earlier quoted context omitted.

Python is a great language for other reasons. Forcing you to indent isn't one of those reasons.

The statement wasn't on greatness. The statement was on "never good." I think the programming community largely agrees that indenting is good. If something is forcing you to do something that is good, then it definitely doesn't fall into the category of "never good." I can't think of a single time in the nearly 10 years of using Python daily that made me want it to operate differently w.r.t. indenting.

Indenting is good. (as is, generally, being consistent and readable)

Indenting as code always struck me as a horrible idea. Better than, say, type coercion... but still horrible.

Re: What I wish I knew before building a Shopify App

#120
post #76

Earlier quoted context omitted.

> `import shopify` makes an API request. Especially for a company that prides itself on great API design, this is head scratching. ‘shopify.Init()’ seems like such an obvious solution

The fact that you can have side effects on imports, and that a lot of libraries relied on side effects on import, was one of my biggest sources of frustration with Python

Can’t you do this with any interpreted language? On ruby your import could redefine anything.
Post reply on HN