Sign in

A series of programming design patterns illustration with examples with JavaScript/Python

Photo by Shardar Tarikul Islam on Unsplash
  • Loose coupling between client and subsystems.
  • Make underlying systems easy to use and test.
  • Simplified interface thanks to a layer of indirection of facade.
  • Facade is a wrapper of implementations of multiple sub systems through unified interface.

Photo by Daniel Klein on Unsplash

Previously

Application

  • Download full workspace model with all channels, users, emoji, etc.
  • Establish real time websocket
  • Push updates via websocket
  • API calls for channel history, message edits, create channels, etc.

Database

  • Assign a workspace to a DB and MS shard at creation
  • Metadata table lookup for each API request to route
  • DBs run in active/active pairs with application failover
  • Service hosts are addressed in config and manually replaced

Challenges with Scalling up


Photo by Daniel Klein on Unsplash
  • Scale out
  • Scale up
  • Scale the dev team

Scale out

  • Storage: needs to be consistent across data centers
  • Computing: driven by user traffic, as needed basis
  • PostgreSQL: relational database: user, media, friendship etc. One master for write and slave replicas for read.
  • Cassandra: user feeds, activities etc. Masterless replicas that have different read/write eventual consistency configuration.
  • High performance…

A series of programming design patterns illustration with examples with JavaScript/Python

Photo by Thom Milkovic on Unsplash

Creational Pattern — Adapter

  • Client : calls the Adapter to talk to Adaptee
  • Adapter : twist the Adaptee’s interface to make it acceptable by the Client
  • Adaptee : does nothing, simply has its interface to be twisted by Adapter.

A series of programming design patterns illustration with examples with JavaScript/Python

Photo by Pesce Huang on Unsplash

Creational Pattern — Singleton

  • Global variables are prone to modification/changes. Local…

A series of programming design patterns illustration with examples with JavaScript/Python

Photo by Andrew “Donovan” Valdivia on Unsplash

Creational Pattern — Builder


A series of programming design patterns illustration with examples with JavaScript/Python

Photo by Jezael Melgoza on Unsplash

Creational Pattern — Factory

from abc import…

Photo by Dina Nasyrova on Unsplash
  • Authentication: Who the user is
  • Authorisation: What the user can access (authentication is normally the first step of authorisation)

Single sign-on


Chapter 11. Stream Processing

Photo by shiyun on Unsplash

Transmitting event streams

Messaging systems

  1. What happens if the producers send messages faster than the consumers can process them?


Chapter 10. Batch Processing

Photo by Mae Mu on Unsplash
  • System of records: acts as a source of truth, being represented only once, and usually normalised.
  • Derived data systems: the result of transforming or processing data from other source; can easily be recreated if lost, usually denormalised and redundant.
  • Transmitting event streams
  • Databases and streams
  • Processing Streams

E.Y.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store