Everything is an HTTPS interface

Ant Stanley
Serverless Zone
Published in
4 min readJul 31, 2017

--

In the Linux world everything is file, in the Serverless world everything is an HTTPS interface.

Serverless applications by their nature are heavily decomposed into a variety of services, such as autonomous functions, object storage, authentication services, document databases, and pub/sub message queues. The interfaces between these services are typically HTTPS. When you’re using the AWS SDK to call an AWS services, the interface it’s calling under the hood is an HTTPS interface. This is true for the majority of cloud platforms, with some alternative protocols occasionally being used (WebSockets and MQTT) in specific use cases.

In the same way that in Linux you can access all the resources of the underlying machine through the file system, in a serverless world you can access all the resources of the underlying cloud platform through an HTTPS interface.

The comparison though goes further than just use of a common interface, serverless application design best practice is starting to look a lot like the Unix Philosophy, which extends to Linux (lets not talk about systemd).

Doug McIlroy distilled the Unix Philosophy down to

“Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.”

Adapting the Unix Philosophy for the serverless world is simply a matter of changing the interface.

“Write programs that do one thing and do it well. Write programs to work together. Write programs to handle https, because that is a universal interface”.

Doug McIlory in an extended definition of the Unix Philosophy makes these four points.

  • Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new features.
  • Expect the output of every program to become the input to another, as yet unknown, program. Don’t clutter output with extraneous information. Avoid stringently columnar or binary input formats. Don’t insist on interactive input.
  • Design and build software, even operating systems, to be tried early, ideally within weeks. Don’t hesitate to throw away the clumsy parts and rebuild them.
  • Use tools in preference to unskilled help to lighten a programming task, even if you have to detour to build the tools and expect to throw some of them out after you’ve finished using them.

Paul Johnston in his talk, What I Wish I’d Known Last Year, at ServerlessConf in NYC last year, touched on some simple principles he found useful for designing serverless applications, namely

  • Start with Deployment Management
  • You can afford to fail faster
  • Zero or 1 data transformation per function
  • Don’t overcomplicate your data schema

Paul’s points could almost be corollaries to Doug’s points.

Eric S. Raymond expands on the Unix philosophy in his book, The Art of Unix Programming, abstracting 17 ideas that could just as easily be used for designing serverless applications.

  1. Rule of Modularity: Write simple parts connected by clean interfaces.
  2. Rule of Clarity: Clarity is better than cleverness.
  3. Rule of Composition: Design programs to be connected to other programs.
  4. Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
  5. Rule of Simplicity: Design for simplicity; add complexity only where you must.
  6. Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
  7. Rule of Transparency: Design for visibility to make inspection and debugging easier.
  8. Rule of Robustness: Robustness is the child of transparency and simplicity.
  9. Rule of Representation: Fold knowledge into data so program logic can be stupid and robust.
  10. Rule of Least Surprise: In interface design, always do the least surprising thing.
  11. Rule of Silence: When a program has nothing surprising to say, it should say nothing.
  12. Rule of Repair: When you must fail, fail noisily and as soon as possible.
  13. Rule of Economy: Programmer time is expensive; conserve it in preference to machine time.
  14. Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.
  15. Rule of Optimization: Prototype before polishing. Get it working before you optimize it.
  16. Rule of Diversity: Distrust all claims for “one true way”.
  17. Rule of Extensibility: Design for the future, because it will be here sooner than you think.

These 17 points can be applied directly to serverless design with no adjustment. Follow all of these, and you will have a scalable, debuggable, maintainable serverless application.

Good Serverless design is the Unix Philosophy reimagined for a new world of building applications on top of clouds.

Ant

“There is no such thing as a new idea” — Mark Twain

--

--