Skip to content

Instantly share code, notes, and snippets.

@coder-mike
coder-mike / io-class-pattern.md
Created February 21, 2019 22:15 — forked from phoddie/io-class-pattern.md
For Ecma TC53

I/O class pattern

Copyright 2018 Moddable Tech, Inc.
Peter Hoddie
Patrick Soquet
Updated December 17, 2018

Overview

The I/O class pattern is designed to be applied to many different interfaces. These include digital, analog input, SPI, I2C, serial, TCP socket, UDP socket, etc. Each of these defines a class pattern for the interface (e.g. a Digital class pattern) that is a logical subclass of the I/O class pattern.

The I/O class pattern assumes read and write operations will not block for significant periods of time (this is deliberately not quantified). The model for this is non-blocking network sockets.