Skip to content

Commit 440ca03

Browse files
author
Phil Sturgeon
committed
Done
1 parent 42056f6 commit 440ca03

File tree

6 files changed

+107
-111
lines changed

6 files changed

+107
-111
lines changed
Loading
143 KB
Loading
-372 KB
Binary file not shown.
52.4 KB
Loading
-433 KB
Binary file not shown.

tales-of-woe-and-woah/index.html

Lines changed: 107 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,9 @@ <h1 style="background: rgba(0, 0, 0, 0.25)">From Bristol 🇬🇧</h1>
6262
<h1>HORROR STORIES!</h1>
6363
</section>
6464

65-
<section data-background-color="white" data-background-image="./img/slow-dodgy-system.png" data-background-size="contain">
66-
</section>
67-
68-
<section data-background-color="white" data-background-image="./img/current-system.png" data-background-size="contain">
69-
</section>
70-
7165
<section data-background-color="white" data-background-image="./img/better-system.png" data-background-size="contain">
7266
</section>
7367

74-
7568
<section>
7669
<h1>Don't Do Slow Stuff</h1>
7770
<ul>
@@ -122,14 +115,16 @@ <h2>Restrict pagination limit size!</h2>
122115
<p>Don't let an unpaginated endpoint be a DDoS vector.</p>
123116
</section>
124117

118+
<section style="font-size:63px">
119+
<h2>Includes are cool</h2>
120+
<p>But, restrict what people can include.</p>
121+
</section>
125122

126-
<section data-markdown>
127-
<script type="text/template">
128-
## Selective Includes
129-
130-
- Avoid letting includes be a DDoS vector and generally a PITA.
131-
- MEGAINCLUDE OF DOOM
132-
</script>
123+
<section style="font-size:63px">
124+
?include=literally,everything,in,<br/>
125+
the,goddam,database,what,is,<br/>
126+
happening,so,slow,help,me,database,<br/>
127+
server,is,on,fire,agggghhhhhh
133128
</section>
134129

135130
<section data-markdown>
@@ -162,12 +157,25 @@ <h2>Instagram Didn't</h2>
162157
</script>
163158
</section>
164159

165-
<section data-markdown>
166-
<script type="text/template">
167-
## Server Errors on 200
168-
- APIERROR 5 THE FUCK IS THAT
169-
- Runscope will not report them
170-
</script>
160+
<section>
161+
<h2>Ruscope helps you catch liars</h2>
162+
<img src="./img/2-minute-web-response.png">
163+
</section>
164+
165+
<section>
166+
<h2>Server Errors on 200</h2>
167+
168+
<img src="./img/200-error.png" />
169+
</section>
170+
171+
<section>
172+
<img src="./img/insanity-wolf-200.jpg" />
173+
174+
<ul>
175+
<li class="fragment">Nothing to do with REST</li>
176+
<li class="fragment">RPC should use status codes properly too!</li>
177+
<li class="fragment">Runscope, New Relic etc. will not report</li>
178+
</ul>
171179
</section>
172180

173181
<section class="has-light-background" data-background-color="#80b682">
@@ -266,134 +274,122 @@ <h2>Instagram Didn't</h2>
266274

267275

268276
<section>
269-
<section>
270-
<h2>Talking over HTTP</h1>
271-
<ul>
272-
<li>Expect the worst from everyone</li>
273-
<li class="fragment">The response might not contain JSON</li>
274-
<li class="fragment">The response might be empty</li>
275-
<li class="fragment">The response might never come!</li>
276-
</ul>
277+
<h2>Talking over HTTP</h1>
278+
<ul>
279+
<li>Expect the worst from everyone</li>
280+
<li class="fragment">The response might not contain JSON</li>
281+
<li class="fragment">The response might be empty</li>
282+
<li class="fragment">The response might never come!</li>
283+
</ul>
277284

278-
<pre class="fragment fade-in"><code data-trim data-noescape>
285+
<pre class="fragment fade-in"><code data-trim data-noescape>
279286
def get_something(id)
280-
response = JSON.parse(client.get('/api/something/'+id))
281-
282-
if response['RESPONSE']['CODE'] == "SUCCESS"
283-
return response
284-
elsif response['RESPONSE']['CODE'] == 'NOT FOUND'
285-
return response
286-
else
287-
message = response['RESPONSE']['APIERROR']
288-
raise SomeError, "Error from third-party API: #{message}."
289-
end
287+
response = JSON.parse(client.get('/api/something/'+id))
288+
289+
if response['RESPONSE']['CODE'] == "SUCCESS"
290+
return response
291+
elsif response['RESPONSE']['CODE'] == 'NOT FOUND'
292+
return response
293+
else
294+
message = response['RESPONSE']['APIERROR']
295+
raise SomeError, "Error from third-party API: #{message}."
296+
end
290297
end
291-
</code></pre>
298+
</code></pre>
292299

293-
<ul>
294-
<li class="fragment">This will explode in so many ways</li>
295-
</ul>
296-
</section>
300+
<ul>
301+
<li class="fragment">This will explode in so many ways</li>
302+
</ul>
303+
</section>
297304

298-
<section data-background-image="./img/dont-trust-returned-content.png">
299-
</section>
305+
<section data-background-image="./img/dont-trust-returned-content.png">
306+
</section>
300307

301-
<section>
302-
<h2>Talking over HTTP</h1>
303-
<ul>
304-
<li>If it's not JSON, catch that exception</li>
305-
</ul>
308+
<section>
309+
<h2>Talking over HTTP</h1>
310+
<ul>
311+
<li>If it's not JSON, catch that exception</li>
312+
</ul>
306313

307-
<pre class="fragment fade-in"><code data-noescape>
314+
<pre class="fragment fade-in"><code data-noescape>
308315
def get_something(id)
309-
response = JSON.parse(client.get('/api/something/'+id))
310-
311-
if response['RESPONSE']['CODE'] == "SUCCESS"
312-
return response
313-
elsif response['RESPONSE']['CODE'] == 'NOT FOUND'
314-
return response
315-
else
316-
message = response['RESPONSE']['APIERROR']
317-
raise SomeError, "Error from third-party API: #{message}."
318-
end
316+
response = JSON.parse(client.get('/api/something/'+id))
317+
318+
if response['RESPONSE']['CODE'] == "SUCCESS"
319+
return response
320+
elsif response['RESPONSE']['CODE'] == 'NOT FOUND'
321+
return response
322+
else
323+
message = response['RESPONSE']['APIERROR']
324+
raise SomeError, "Error from third-party API: #{message}."
325+
end
319326
<mark>rescue JSON::ParserError => e
320-
raise HttpServerError, "Service returned invalid JSON data"</mark>
327+
raise HttpServerError, "Service returned invalid JSON data"</mark>
321328
end
322-
</code></pre>
323-
</section>
329+
</code></pre>
330+
</section>
324331

325332

326-
<section>
327-
<h2>Talking over HTTP</h1>
328-
<ul>
329-
<li>The response might be empty if its a timeout</li>
330-
</ul>
333+
<section>
334+
<h2>Talking over HTTP</h1>
335+
<ul>
336+
<li>The response might be empty if its a timeout</li>
337+
</ul>
331338

332-
<pre class="fragment fade-in"><code data-trim data-noescape>
339+
<pre class="fragment fade-in"><code data-trim data-noescape>
333340
def get_something(id)
334-
response = JSON.parse(client.get('/api/something/'+id))
341+
response = JSON.parse(client.get('/api/something/'+id))
335342

336-
if response.nil?
337-
raise HttpServerError, "Service returned an empty response"
338-
end
343+
if response.nil?
344+
raise HttpServerError, "Service returned an empty response"
345+
end
339346

340-
# ... success or fail
347+
# ... success or fail
341348

342349
rescue JSON::ParserError => e
343-
raise HttpServerError, "Service returned invalid JSON data"
350+
raise HttpServerError, "Service returned invalid JSON data"
344351
end
345-
</code></pre>
346-
</section>
352+
</code></pre>
353+
</section>
347354

348-
<section>
349-
<h2>Talking over HTTP</h1>
350-
<ul>
351-
<li>The response might be a weird shape</li>
352-
</ul>
355+
<section>
356+
<h2>Talking over HTTP</h1>
357+
<ul>
358+
<li>The response might be a weird shape</li>
359+
</ul>
353360

354-
<pre class="fragment fade-in"><code data-trim data-noescape>
361+
<pre class="fragment fade-in"><code data-trim data-noescape>
355362
def get_something(id)
356-
response = JSON.parse(client.get('/api/something/'+id))
363+
response = JSON.parse(client.get('/api/something/'+id))
357364

358-
if response.nil?
359-
raise HttpServerError, "Service returned an empty response"
360-
end
365+
if response.nil?
366+
raise HttpServerError, "Service returned an empty response"
367+
end
361368

362-
unless response['RESPONSE'] && response['RESPONSE']['CODE']
363-
raise HttpServerError, "Service returned an unexpected response: #{response}"
364-
end
369+
unless response['RESPONSE'] && response['RESPONSE']['CODE']
370+
raise HttpServerError, "Service returned an unexpected response: #{response}"
371+
end
365372

366-
# ... success or fail
373+
# ... success or fail
367374

368375
rescue JSON::ParserError => e
369-
raise HttpServerError, "Service returned invalid JSON data"
376+
raise HttpServerError, "Service returned invalid JSON data"
370377
end
371-
</code></pre>
372-
</section>
378+
</code></pre>
373379
</section>
374380

375381
<section>
376-
382+
<h2>Documentation is not optional</h2>
377383
<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">The UPS API is so sparsely documented I&#39;m having to actually send parcels to see what sort of data I get for specific situations.</p>&mdash; Dan Harper (@DanHarper7) <a href="https://twitter.com/DanHarper7/status/748550285761601536">June 30, 2016</a></blockquote>
378-
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
379-
</section>
380-
381-
382-
<section data-markdown>
383-
<script type="text/template">
384-
## At least one dev API per team
385-
- Avoid versioning REST/etc by evolving APIs
386-
- Can't "evolve" staging if multiple clients develop against it
387-
- This is how you get stuck on JSON-API v1.0 RC-2 forever two years 😭
388-
</script>
384+
<p class="fragment">Learn how to build docs: <a href="http://bit.ly/api-doc-video">bit.ly/api-doc-video</a></p>
389385
</section>
390386

391387
<section data-markdown>
392388
<script type="text/template">
393389
## Stop services lying to each other
394-
- strong parameters
395-
- php https://packagist.org/packages/koine/strong-parameters
396-
- VCR instead of static stubs
390+
- Strong Parameters
391+
- For PHP: https://packagist.org/packages/koine/strong-parameters
392+
- PHP-VCR instead of static stubs
397393
- Be sure to re-record VCR stubs
398394
- Jenkins can host your entrie stack with Docker Compose
399395
</script>

0 commit comments

Comments
 (0)