Josh Comer
June 04, 2016
160

# Recursive Architecture

June 04, 2016

## Transcript

4. ### Recursions 101 Definition: see recursion Real Definition: the repeated application

of a procedure or definition Two mirrors, fractals, etc.
5. ### CS Recursion Everyone’s favourite topic in school Remember recursion ==

iteration Fib(n) = Fib(n-1) + Fib(n-2), Fib(0)=0, Fib(1)=1 Fib is interesting case as naïve recursion leads to O(phi^n) while naïve iteration is O(n), though easy to fix.
6. ### Quicksort Divide and Conquer (defn qsort3 [[pivot :as coll]] (when

pivot (lazy-cat (qsort (filter #(< % pivot) coll)) (filter #{pivot} coll) (qsort (filter #(> % pivot) coll)))))
7. ### So what’s the big deal Recursion is pure Recursion is

clean Recursion is terse The barrier to solving a problem recursively usually means the solution has been thought through
8. ### Conway’s Law organizations which design systems ... are constrained to

produce designs which are copies of the communication structures of these organizations — M. Conway

Variety

12. ### Blog Driven Development Someone who is greatly influenced by reading

a single blog post… daily ...and then changes all the code

14. ### Stack Overflow Driven Development Someone who codes exclusively using Stack

Overflow answers. I’m a SODD with bash ☺️

the software

19. ### Why do we use patterns? Patterns help us communicate Humans

are really good at patterns
20. ### But… Patterns all start to fall apart if everyone isn’t

on the same page. Not everyone has the GoF book memorized
21. ### Concurrency The next frontier in programing: Vertical Scaling won’t work

anymore But concurrent programming is hard for even the best programmers Abstract away the concurrency!!! - Joe Armstrong
22. ### OO Architecture Design from the abstraction towards the problem Good

OO design requires a lot of upfront effort Distracts from the problem Harder to change (we don’t always get it right the first time)
23. ### Recursive Architecture Conway’s Law We are, seemingly, naturally good at

reasoning about systems in the large Distributed Systems are becoming the new norm
24. ### Where is the recursive part? We can design our services

using the same primitives as our platform The inside mirrors the outside

28. ### TSAP We need to make something that allows us to

store tasks in a list (sorted temporally). In addition to the task list, we want to be able to schedule actions at particular times.

36. ### Scheduler Needs to be: Receive scheduling requests Store pending tasks

Send triggered tasks to the notifier

44. ### Building Blocks There are three main building blocks: API Servers

Processes Pub-Sub
45. ### Building Blocks There are three main building blocks: API Servers

-> Gen-Server Processes -> Actor Pub-Sub -> Gen-Event Supervisors Gen-FSM It’s the Erlang OTP Behaviours
46. ### API Servers are key AXD301 (one of the biggest Erlang

code bases) uses gen- servers for 63% of its behaviours APIs allow us to hide execution particulars (think façade pattern)
47. ### “You know nothing API Snow” An API can hide concurrency

(it acts as a load balancer) An API can make asynchronous calls synchronous An API can provide a translation layer An API can handle errors An API can manage resiliency
48. ### Isn’t this an Interface? Not quite The API is an

active piece of code that contains control logic For example gen-server has fns for: Sync Call Async Call Timeout Shutdown and Startup
49. ### Can we take this further? API Load Balancer DB Scheduler

Notifier(s) Queue

53. ### Microservices Let’s call them nanoservices Even smaller than microservices Responsible

for an extremely small portion of logic Built to be deployed in a shared resource environment with other nanoservices
54. ### Is this even a thing? Actors! Actors are back Erlang

is making a comeback (check out Elixir) Akka or Quasar for Java Akka.net for .NET