Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Nybble
Jun 28, 2008

praise chuck, raise heck
RESTful is pleasant and calming

Adbot
ADBOT LOVES YOU

ThePopeOfFun
Feb 15, 2010

Xarn posted:

I meant it literally means crap.

CrAPPs

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Xarn posted:

I meant it literally means crap.

It's this.

Mega Comrade
Apr 22, 2004

Listen buddy, we all got problems!

Xarn posted:

I meant it literally means crap.

Oh haha I thought it was some awful term for a minority I'd never heard of or something. I'm honestly not sure there is another term in use though, not that I really understand why you care.

Nybble posted:

RESTful is pleasant and calming


CRUD and RESTful aren't the same thing though.

Mega Comrade fucked around with this message at 19:17 on Dec 8, 2022

CPColin
Sep 9, 2003

Big ol' smile.
CRUSTful

Macichne Leainig
Jul 26, 2012

by VG
I prefer my requests without the crust

bigperm
Jul 10, 2001
some obscure reference
We could say Curd. Is Curd better? Curd.

prom candy
Dec 16, 2005

Only I may dance

CPColin posted:

CRUSTful

this is deeply unpleasant and should maybe be the new thread title

Fellatio del Toro
Mar 21, 2009

bigperm posted:

We could say Curd. Is Curd better? Curd.

sorry this api is CURDled and we recommend you migrate to the new version

downout
Jul 6, 2009

DRUC

The NPC
Nov 21, 2010


We call them getties.

GET an object:
code:
curl -X GET http://example.com/api/object
GET new values for the object:
code:
curl -X GET http://example.com/api/object?id=1&updateProperty=accountBalance&propertyNewValue=10000
ForGET your password?
code:
curl -X GET http://example.com/api/user?username=The%20NPC&newPassword=hunter2

Fellatio del Toro
Mar 21, 2009

never stop POSTing

nullfunction
Jan 24, 2005

Nap Ghost
All of the responses are 200 OK with an error message in the JSON payload, right?

Pedestrian Xing
Jul 19, 2007

nullfunction posted:

All of the responses are 200 OK with an error message in the JSON payload, right?

I see you've worked with major financial institutions as well.

redleader
Aug 18, 2005

Engage according to operational parameters

nullfunction posted:

All of the responses are 200 OK with an error message in the JSON payload, right?

this is honestly the most minor crime i've encountered with external apis

champagne posting
Apr 5, 2006

YOU ARE A BRAIN
IN A BUNKER

nullfunction posted:

All of the responses are 200 OK with an error message in the JSON payload, right?

better than using 412 precondition failed for every input error and never specify what is wrong or how it may be remedied

I’m looking at you, Apache Pulsar

Clanpot Shake
Aug 10, 2006
shake shake!

nullfunction posted:

All of the responses are 200 OK with an error message in the JSON payload, right?

I see you have heard the gospel of graphql

Che Delilas
Nov 23, 2009
FREE TIBET WEED
500 Internal Server Error Due To Bad Request

prom candy
Dec 16, 2005

Only I may dance

champagne posting posted:

better than using 412 precondition failed for every input error and never specify what is wrong or how it may be remedied

I’m looking at you, Apache Pulsar

LinkedIn does 400s if you send any of their stupid parameters wrong and no of course they don't tell you which one.

CPColin
Sep 9, 2003

Big ol' smile.
Stupid parameters need the most validation!

champagne posting
Apr 5, 2006

YOU ARE A BRAIN
IN A BUNKER

prom candy posted:

LinkedIn does 400s if you send any of their stupid parameters wrong and no of course they don't tell you which one.

Welp I forgot to mention pulsar will also send you back 412 when it is having issues.

Like say if you’re creating a namespace, a construct which contains subscriptions and other things, you can by default for my provider only create 1024. The 1025th namespace attempted created will return 412

Also you are allowed to increase the limit leading to further questions like “why” and “what is wrong with this thing god damnit”

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Che Delilas posted:

500 Internal Server Error Due To Bad User

CPColin
Sep 9, 2003

Big ol' smile.
Ah yes, an external server error

Carbon dioxide
Oct 9, 2012

What's the HTTP code for "oops your request made our server explode"?

Mega Comrade
Apr 22, 2004

Listen buddy, we all got problems!
At my current place, one guy did most of the external facing APIs, and when he left and they got dumped on me, I've noticed most of it threw 420 errors.

Mega Comrade fucked around with this message at 10:33 on Dec 9, 2022

AgentF
May 11, 2009
420 Server Up In Smoke

Judge Schnoopy
Nov 2, 2005

dont even TRY it, pal
301 Redirected (back to you (as a successful response (here's your json)))

The Dark Souls of Posters
Nov 4, 2011

Just Post, Kupo
What about cloud flare giving you a 502 even though it got a normal 200 response within the timeout parameter causing the request to get retried despite success

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Mega Comrade posted:

At my current place, one guy did most of the external facing APIs, and when he left and they got dumped on me, I've noticed most of it threw 420 errors.

twitter unofficially added the 420 status code https://developer.twitter.com/ja/docs/basics/response-codes

420 is a status code meaning "enhance your calm." means that your app is being rate limited for making too many requests. hilarious.

prom candy
Dec 16, 2005

Only I may dance

CPColin posted:

Stupid parameters need the most validation!

lol

Cup Runneth Over
Aug 8, 2009

She said life's
Too short to worry
Life's too long to wait
It's too short
Not to love everybody
Life's too long to hate


Che Delilas posted:

500 Internal Server Error Due To Bad Request

An API unironically returning this because I had a ^ character in my password :rolleyes: That was a fun one to debug

raminasi
Jan 25, 2005

a last drink with no ice

ultrafilter posted:

Is there a different term for CRUD apps that sounds less derogatory?

Most CRUD apps are Line Of Business Apps, or LOBAs, which might get you want you want. (Of course, LOBA is the short form - the full name is "Boring Line Of Business App," so...)

smackfu
Jun 7, 2004

Really what business apps aren’t CRUD apps anyways?

raminasi
Jan 25, 2005

a last drink with no ice
Ok I'm having real trouble figuring out constructive communication in response to some stuff that a guy on my team does. I just had an quintessential exchange. Here was the existing code (please forgive any syntactic errors, they were just introduced by my obfuscation):
JavaScript code:
if (thingThatMightBeTrue) {
    config.API = { importantStuff: { importantKey: importantValue } };
}
He opened a PR with this addition:
JavaScript code:
if (thingThatMightBeTrue) {
    config.API = { importantStuff: { importantKey: importantValue } };
}
if (otherThingThatMightBeTrue) {
    config.API = { importantStuff: { otherImportantKey: otherImportantValue } };
}
My comment on the PR, because I don't know JavaScript very well and thought I legitimately might not understand something: "Will that merge the properties of importantStuff or will the second one overwrite the first one" (which would be incorrect), to which he replied that they'd be merged, with no other explanation.

Now either he's right and I still don't understand, or he's wrong, so I get him on Slack, and it turns out that yes, there would be an incorrect overwrite. So he "fixes" it:
JavaScript code:
if (thingThatMightBeTrue) {
    config.API = { importantStuff: { importantKey: importantValue } };
}
if (thingThatMightBeTrue && otherThingThatMightBeTrue) {
    config.API = { importantStuff: { importantKey: importantValue, otherImportantKey: otherImportantValue } };
}
I ask the obvious question: "What will this do if otherThingThatMightBeTrue is true but thingThatMightBeTrue is false?" and he sees the problem and fixes it. But it felt like a lot of hand-holding for someone with 4-5 years of experience. And maybe my expectations are misaligned, and maybe they aren't, but either way I want to find a way to generalize the thought process I went through for him in a way that's more useful than "when you're writing code, you should think about what it would do, and not write code that will do the wrong thing," but that's all I can think of here. Does anyone have any ideas?

Harriet Carker
Jun 2, 2009

At a first glance, the best comment you could post is “where are the unit tests?”

This back and forth would be easily solved if this was a named, tested function.

Love Stole the Day
Nov 4, 2012
Please give me free quality professional advice so I can be a baby about it and insult you

Harriet Carker posted:

At a first glance, the best comment you could post is “where are the unit tests?”

This back and forth would be easily solved if this was a named, tested function.

This is the best way to say it imo. Argue about the unit test cases it needs to cover. Best case scenario, the person's team had already discussed it or wrote about the important test cases in the Jira ticket or whatever.

smackfu
Jun 7, 2004

Also like, some people spend 4-5 years improving and other people just don’t.

Usually the people in the first group leave your company after a couple of years of course.

Judge Schnoopy
Nov 2, 2005

dont even TRY it, pal

Harriet Carker posted:

At a first glance, the best comment you could post is “where are the unit tests?”

This back and forth would be easily solved if this was a named, tested function.

I used to code like the offending coworker, for me it was all about moving as fast as possible to "show skill" at software development.

I solved it by writing unit tests as well. It forces me to slow down and consider edge cases instead of smashing the commit button

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

raminasi posted:

Ok I'm having real trouble figuring out constructive communication in response to some stuff that a guy on my team does. I just had an quintessential exchange. Here was the existing code (please forgive any syntactic errors, they were just introduced by my obfuscation):
JavaScript code:
if (thingThatMightBeTrue) {
    config.API = { importantStuff: { importantKey: importantValue } };
}
He opened a PR with this addition:
JavaScript code:
if (thingThatMightBeTrue) {
    config.API = { importantStuff: { importantKey: importantValue } };
}
if (otherThingThatMightBeTrue) {
    config.API = { importantStuff: { otherImportantKey: otherImportantValue } };
}
My comment on the PR, because I don't know JavaScript very well and thought I legitimately might not understand something: "Will that merge the properties of importantStuff or will the second one overwrite the first one" (which would be incorrect), to which he replied that they'd be merged, with no other explanation.

Now either he's right and I still don't understand, or he's wrong, so I get him on Slack, and it turns out that yes, there would be an incorrect overwrite. So he "fixes" it:
JavaScript code:
if (thingThatMightBeTrue) {
    config.API = { importantStuff: { importantKey: importantValue } };
}
if (thingThatMightBeTrue && otherThingThatMightBeTrue) {
    config.API = { importantStuff: { importantKey: importantValue, otherImportantKey: otherImportantValue } };
}
I ask the obvious question: "What will this do if otherThingThatMightBeTrue is true but thingThatMightBeTrue is false?" and he sees the problem and fixes it. But it felt like a lot of hand-holding for someone with 4-5 years of experience. And maybe my expectations are misaligned, and maybe they aren't, but either way I want to find a way to generalize the thought process I went through for him in a way that's more useful than "when you're writing code, you should think about what it would do, and not write code that will do the wrong thing," but that's all I can think of here. Does anyone have any ideas?

Murder them and build your codebase upon his corpse

Adbot
ADBOT LOVES YOU

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Yeah looks like they just want to close the ticket and you're in the way.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply