Skip to main content

Interface Driven Development

Interface Driven Development (IDD), aka contract-driven development, is a development approach that focuses on defining what components need before how to meet those needs.

Systems developed using IDD - especially distributed systems - are more loosely coupled, robust and maintainable.

WebAssembly modules operate in a completely isolated sandbox, meaning that they can only perform logical operations with no access to system resources like I/O, networking and syscalls.

In functional programming terminology we might call these modules "pure", as they can only map inputs to outputs without producing side-effects. Without any side-effects, how can we use WebAssembly components to do anything useful in our applications?

Interface (or contract) driven development is the core that makes wasmCloud possible.

In order to use isolated WebAssembly modules for useful work, we have to build explicit paths in and out of the module and pass them as inputs. These paths are defined using abstractions called interfaces which specify exactly what kinds of functions and data types the modules have access to.

These interfaces give our sandboxed WebAssembly components access to external services:

  • key-value stores
  • HTTP servers & clients
  • message brokers
  • ... and much more

As you make your way through the concepts you'll see many examples of interfaces and their implementations (called capability providers).