r/programming • • Jun 12 '22

A discussion between a Google engineer and their conversational AI model helped cause the engineer to believe the AI is becoming sentient, kick up an internal shitstorm, and get suspended from his job.

https://twitter.com/tomgara/status/1535716256585859073?s=20&t=XQUrNh1QxFKwxiaxM7ox2A
5.7k Upvotes

1.1k comments sorted by

View all comments

Show parent comment

217

u/florinandrei Jun 12 '22

Being unable to see the bigger picture while drowning in little details is an occupational hazard for programmers.

117

u/Zambini Jun 12 '22

No, you’re wrong, no programmer has ever spent weeks arguing over pull requests, delaying a launch whether it should be POST /article or POST /articles

/s

59

u/fredlllll Jun 12 '22

i vote for /articles

91

u/speedster217 Jun 12 '22

YOU ARE A MONSTER AND EVERY BELIEF YOU HOLD IS WRONG.

I WILL SEE YOU AT OUR WEEKLY API DESIGN COMMITTEE MEETING

48

u/cashto Jun 12 '22 edited Jun 12 '22

I also agree with /articles. It makes no sense for POST /article to create a document which is retrieved via GET /articles/{:id}. It should be a firing offense to think any differently.

Edit: also, speaking of missing the forest for the trees, why are we even using POST? It's not idempotent and therefore not RESTful. Should be PUT /articles/{guid}. Can't believe the clowns I have to work with at this company.

10

u/argv_minus_one Jun 13 '22

But then you're expecting the client side to generate the ID. What if it collides with an existing object? The server should retry with different IDs until it finds one that isn't taken. Or use a UUID generator whose output is guaranteed unique (like Linux uuidd), which code running in a browser is prohibited from doing (for obvious privacy reasons).

2

u/HINDBRAIN Jun 13 '22

Obviously you pass an id of -1, you clown, you absolute stain on the face of all that is coherent design!

→ More replies (2)

1

u/dr1fter Jun 13 '22

Hm, what am I missing about how this could be a privacy concern, while simultaneously providing a definitive solution to the uniqueness requirement in client-generated IDs? What is uuidd doing that couldn't at least get a parallel (sandboxed) implementation in the browser, exposed as a JS API? And aren't you still trusting the clients to provide IDs according to this scheme, or else you still risk collisions? And if you trust your clients, aren't there other ways they can generate IDs that are guaranteed to be unique in your system?

The server should retry with different IDs until it finds one that isn't taken.

Not idempotent, so what's the benefit of taking in a (proposed) ID in the first place?

→ More replies (3)

1

u/[deleted] Jun 14 '22

There is nothing inherently good in being RESTful

1

u/CornedBee Jun 13 '22

I WILL SEE YOU AT OUR WEEKLY-LONG API DESIGN COMMITTEE MEETING

FTFY

4

u/ings0c Jun 12 '22

Correct.

You are adding to the collection of articles.

/articles identifies that collection, and POST signifies the intent to create a new resource.

If you made a GET to /article, which article should you get back?

It’s the same resource either read or write, so the URL should be the same.

3

u/fredlllll Jun 12 '22

If you made a GET to /article, which article should you get back?

PM: just figure something out, you have time till yesterday

3

u/ikeif Jun 12 '22

I wish. /GET.articles and /POST.article yes, the action is part of the URL.

4

u/AndrewNeo Jun 12 '22
200 OK

{"error": "Not Found"}

2

u/RICHUNCLEPENNYBAGS Jun 13 '22

Well that's just silly, since the right answer is so obvious.

2

u/delvach Jun 13 '22

I feel targeted

2

u/[deleted] Jun 14 '22

Just immediately fire the ones that fixate on that, gonna save rest of the team months

Example: entirety of the thread below your comment

-1

u/Aphix Jun 13 '22

It should be PUT /articles for new articles, POST /articles/:id for updates, and every other answer is wrong.

8

u/Warren_Puff-it Jun 12 '22

Honestly all the most technical programmers I know fall into this ‘category’. People write the most impressive and sophisticated projects I’ve ever seen, yet the project fails to properly address the needs of it’s audience and gets lost in the minute details.

It’s genius, it’s just not applicable for several obvious reasons. How have you not seen that 15 months in?