Programming Search⌘K

Patterncore

Adapter pattern

Also called Adapter, wrapper.

An adapter converts the interface of an existing class into the interface that a client expects. The client and the class stay as they are, and the adapter translates each call.

Family
structural-design
Intent
Convert the interface of a class into another interface that clients expect, so that classes with interfaces that do not match can work together.
Also called
Wrapper
Refactorings
Unify interfaces with adapter, Extract adapter

Intent

Convert the interface of a class into the interface that a client expects. Then classes that could not work together, because their interfaces do not match, can work together.1

Problem

A dashboard shows temperatures. Its code calls celsius() on each sensor and prints the result. The sensors that the team wrote have that method. Then the team must add an old thermometer from a vendor library. Its class has no celsius(). It has fahrenheit_tenths(), which returns an integer in tenths of a degree Fahrenheit, so 98.6 F is 986.

The two direct fixes are both bad. The team can change the dashboard to test for each kind of sensor and convert. Then the dashboard knows every vendor, and each added sensor changes it again. Or the team can change the vendor class. Often they cannot, because it is in a library, and when they can, every update of the library undoes the change.

Kerievsky describes the same starting point in two forms. Clients use two classes, and one of the two has the preferred interface. Or one class adapts several versions of a component, library or API, and the code for each version is mixed together.2

The forces are these. The client must keep one interface. The existing class must not change. The translation between the two must live in one place, where a test can reach it.

Solution

Write a class that implements the interface of the client (the Target) and holds an instance of the existing class (the Adaptee). Each method of the Target calls the methods of the Adaptee and converts the arguments, the results and the errors.1

 Client (dashboard)
   calls celsius()
        |
        v
 Target: Thermometer                 Adaptee: LegacyThermometer
 ------------------                  --------------------------
 celsius() -> float                  fahrenheit_tenths() -> int
        ^                                     ^
        |  implements                         |  holds one
        |                                     |
 Adapter: LegacyAdapter(legacy) --------------+
   celsius():
     tenths = legacy.fahrenheit_tenths()
     return (tenths / 10 - 32) * 5 / 9

Design Patterns gives two forms.1 An object adapter holds the adaptee and forwards to it, as above. It can adapt the class and all its subclasses, and the adaptee can be chosen at run time. A class adapter inherits from the adaptee and implements the target, so it needs multiple inheritance or an interface. It can override behaviour of the adaptee, but it adapts one concrete class only. Most code uses the object form, because composition works in every language that has references.

A function type can be the adapter. Go net/http defines HandlerFunc, a function type with a ServeHTTP method that calls the function. Its documentation calls it an adapter that allows the use of ordinary functions as HTTP handlers.3 Here the target is an interface with one method, and the adaptee is a plain function. With first-class functions, an adapter of one function is a function. It takes the old function and returns one with the signature of the target. Node util.promisify takes a function that uses an error-first callback and returns a version that returns promises.8

Standard libraries adapt streams. java.io.InputStreamReader is a bridge from byte streams to character streams: it reads bytes and decodes them into characters with a charset.4 .NET StreamReader implements a TextReader that reads characters from a byte stream in an encoding.9 Python io.TextIOWrapper gives a text interface over a buffered binary stream.7 Python contextlib.closing adapts any object with a close() method to a context manager, which closes it at the end of a with block.6

Example

The example files show one program in each language. The dashboard function takes a Thermometer and prints its temperature in Celsius with one decimal. The program shows a native sensor at 21.5 C, then the legacy thermometer through the adapter at readings 986 and 704. The output is 21.5 C, 37.0 C and 21.3 C.

Language Form
Python a class with celsius() that holds the legacy object
JavaScript a class that holds the legacy object
TypeScript a class that implements the interface; structural types also accept an object literal
Java an interface and a final class that holds the legacy object
Kotlin a fun interface, so a lambda that reads the legacy object is the adapter
C# an interface and a sealed class with a primary constructor
Go a function type with a method, in the form of http.HandlerFunc
Rust a newtype struct that wraps the legacy type and implements the trait
C++ an abstract class and an object adapter that holds a reference
PythonGitHub
from typing import Protocol


class Thermometer(Protocol):
    def celsius(self) -> float: ...


def report(name: str, sensor: Thermometer) -> None:
    print(f"{name}: {sensor.celsius():.1f} C")


class RoomSensor:
    def __init__(self, value: float) -> None:
        self.value = value

    def celsius(self) -> float:
        return self.value


# The vendor class. The program cannot change it.
class LegacyThermometer:
    def __init__(self, tenths: int) -> None:
        self.tenths = tenths

    def fahrenheit_tenths(self) -> int:
        return self.tenths


class LegacyAdapter:
    def __init__(self, legacy: LegacyThermometer) -> None:
        self.legacy = legacy

    def celsius(self) -> float:
        return (self.legacy.fahrenheit_tenths() / 10 - 32) * 5 / 9


report("lab", RoomSensor(21.5))
report("patient", LegacyAdapter(LegacyThermometer(986)))
report("hall", LegacyAdapter(LegacyThermometer(704)))
Output
lab: 21.5 C
patient: 37.0 C
hall: 21.3 C
  • Verdict: idiom. The adapter is a class with the method that the client calls. It holds the legacy object and converts its result.
  • typing.Protocol states the target interface for a type checker. Neither class inherits from it.
  • For one method, a lambda or a small function can be enough. contextlib.closing and io.TextIOWrapper are adapters in the standard library.
#include <cstdio>
#include <string>

class Thermometer {
public:
    virtual ~Thermometer() = default;
    virtual double celsius() const = 0;
};

void report(const std::string& name, const Thermometer& sensor) {
    std::printf("%s: %.1f C\n", name.c_str(), sensor.celsius());
}

class RoomSensor : public Thermometer {
public:
    explicit RoomSensor(double value) : value_(value) {}
    double celsius() const override { return value_; }

private:
    double value_;
};

// The vendor class. The program cannot change it.
class LegacyThermometer {
public:
    explicit LegacyThermometer(int tenths) : tenths_(tenths) {}
    int fahrenheit_tenths() const { return tenths_; }

private:
    int tenths_;
};

// An object adapter: it implements the target and refers to the adaptee.
class LegacyAdapter : public Thermometer {
public:
    explicit LegacyAdapter(const LegacyThermometer& legacy) : legacy_(legacy) {}
    double celsius() const override {
        return (legacy_.fahrenheit_tenths() / 10.0 - 32) * 5 / 9;
    }

private:
    const LegacyThermometer& legacy_;
};

int main() {
    report("lab", RoomSensor(21.5));
    LegacyThermometer patient(986);
    LegacyThermometer hall(704);
    report("patient", LegacyAdapter(patient));
    report("hall", LegacyAdapter(hall));
}
Output
lab: 21.5 C
patient: 37.0 C
hall: 21.3 C
  • Verdict: idiom. LegacyAdapter holds a reference to the adaptee, so the adaptee must live longer than the adapter. Here both live in main.
  • A class adapter in C++ inherits publicly from the target and privately from the adaptee. It can call the adaptee's methods as its own, but it adapts one concrete class only.
  • std::stack and std::queue are container adaptors. They take an underlying container type and give it a smaller interface.
JavaGitHub
import java.util.Locale;

public class Main {
    interface Thermometer {
        double celsius();
    }

    static void report(String name, Thermometer sensor) {
        System.out.println(String.format(Locale.ROOT, "%s: %.1f C", name, sensor.celsius()));
    }

    record RoomSensor(double value) implements Thermometer {
        public double celsius() {
            return value;
        }
    }

    // The vendor class. The program cannot change it.
    static final class LegacyThermometer {
        private final int tenths;

        LegacyThermometer(int tenths) {
            this.tenths = tenths;
        }

        int fahrenheitTenths() {
            return tenths;
        }
    }

    static final class LegacyAdapter implements Thermometer {
        private final LegacyThermometer legacy;

        LegacyAdapter(LegacyThermometer legacy) {
            this.legacy = legacy;
        }

        public double celsius() {
            return (legacy.fahrenheitTenths() / 10.0 - 32) * 5 / 9;
        }
    }

    public static void main(String[] args) {
        report("lab", new RoomSensor(21.5));
        report("patient", new LegacyAdapter(new LegacyThermometer(986)));
        LegacyThermometer hall = new LegacyThermometer(704);
        report("hall", () -> (hall.fahrenheitTenths() / 10.0 - 32) * 5 / 9);
    }
}
Output
lab: 21.5 C
patient: 37.0 C
hall: 21.3 C
  • Verdict: idiom. LegacyAdapter is an object adapter: it implements the target interface and holds the adaptee.
  • Thermometer has one abstract method, so a lambda can implement it. The third call uses a lambda as the adapter.
  • 10.0 makes the division use double. With 10, Java divides integers and drops the tenths.
  • Locale.ROOT fixes the decimal point. The default locale can print a comma.
using System.Globalization;

static void Report(string name, IThermometer sensor) =>
    Console.WriteLine($"{name}: {sensor.Celsius().ToString("F1", CultureInfo.InvariantCulture)} C");

Report("lab", new RoomSensor(21.5));
Report("patient", new LegacyAdapter(new LegacyThermometer(986)));
Report("hall", new LegacyAdapter(new LegacyThermometer(704)));

interface IThermometer
{
    double Celsius();
}

sealed class RoomSensor(double value) : IThermometer
{
    public double Celsius() => value;
}

// The vendor class. The program cannot change it.
sealed class LegacyThermometer(int tenths)
{
    public int FahrenheitTenths() => tenths;
}

sealed class LegacyAdapter(LegacyThermometer legacy) : IThermometer
{
    public double Celsius() => (legacy.FahrenheitTenths() / 10.0 - 32) * 5 / 9;
}
Output
lab: 21.5 C
patient: 37.0 C
hall: 21.3 C
  • Verdict: idiom. The adapter implements the interface of the client and takes the adaptee through a primary constructor parameter.
  • CultureInfo.InvariantCulture fixes the decimal point. The culture of the machine can print a comma.
  • System.IO.StreamReader is an adapter in the class library: it gives a TextReader over a byte Stream.
  • A Func<double> can replace the interface when the client needs only one call, and a lambda is then the adapter.
JavaScriptGitHub
function report(name, sensor) {
  console.log(`${name}: ${sensor.celsius().toFixed(1)} C`);
}

class RoomSensor {
  #value;

  constructor(value) {
    this.#value = value;
  }

  celsius() {
    return this.#value;
  }
}

// The vendor class. The program cannot change it.
class LegacyThermometer {
  #tenths;

  constructor(tenths) {
    this.#tenths = tenths;
  }

  fahrenheitTenths() {
    return this.#tenths;
  }
}

class LegacyAdapter {
  #legacy;

  constructor(legacy) {
    this.#legacy = legacy;
  }

  celsius() {
    return ((this.#legacy.fahrenheitTenths() / 10 - 32) * 5) / 9;
  }
}

report("lab", new RoomSensor(21.5));
report("patient", new LegacyAdapter(new LegacyThermometer(986)));
report("hall", new LegacyAdapter(new LegacyThermometer(704)));
Output
lab: 21.5 C
patient: 37.0 C
hall: 21.3 C
  • Verdict: idiom. The client calls celsius() on any object, so the adapter is any object with that method.
  • An object literal { celsius: () => convert(legacy) } is also an adapter, with no class.
  • Node util.promisify adapts a function with an error-first callback to a function that returns a promise.
TypeScriptGitHub
interface Thermometer {
  celsius(): number;
}

function report(name: string, sensor: Thermometer): void {
  console.log(`${name}: ${sensor.celsius().toFixed(1)} C`);
}

class RoomSensor implements Thermometer {
  private readonly value: number;

  constructor(value: number) {
    this.value = value;
  }

  celsius(): number {
    return this.value;
  }
}

// The vendor class. The program cannot change it.
class LegacyThermometer {
  private readonly tenths: number;

  constructor(tenths: number) {
    this.tenths = tenths;
  }

  fahrenheitTenths(): number {
    return this.tenths;
  }
}

class LegacyAdapter implements Thermometer {
  private readonly legacy: LegacyThermometer;

  constructor(legacy: LegacyThermometer) {
    this.legacy = legacy;
  }

  celsius(): number {
    return ((this.legacy.fahrenheitTenths() / 10 - 32) * 5) / 9;
  }
}

report("lab", new RoomSensor(21.5));
report("patient", new LegacyAdapter(new LegacyThermometer(986)));

// Structural typing: an object literal with the right method is a Thermometer.
const hall = new LegacyThermometer(704);
report("hall", { celsius: () => ((hall.fahrenheitTenths() / 10 - 32) * 5) / 9 });
Output
lab: 21.5 C
patient: 37.0 C
hall: 21.3 C
  • Verdict: idiom. The type checker compares members, not names, so implements Thermometer is a check and an object literal works as the third adapter.
  • report(new LegacyThermometer(704)) without an adapter is a compile error, because the class has no celsius member.
  • The fields are assigned in the constructor body. Node runs this file by removing the types, and that mode does not accept parameter properties.
package main

import "fmt"

type Thermometer interface {
	Celsius() float64
}

func report(name string, sensor Thermometer) {
	fmt.Printf("%s: %.1f C\n", name, sensor.Celsius())
}

type RoomSensor float64

func (r RoomSensor) Celsius() float64 { return float64(r) }

// LegacyThermometer is the vendor type. The program cannot change it.
type LegacyThermometer struct{ tenths int }

func (l LegacyThermometer) FahrenheitTenths() int { return l.tenths }

// CelsiusFunc adapts an ordinary function to Thermometer, as http.HandlerFunc does for handlers.
type CelsiusFunc func() float64

func (f CelsiusFunc) Celsius() float64 { return f() }

func adaptLegacy(l LegacyThermometer) Thermometer {
	return CelsiusFunc(func() float64 {
		return (float64(l.FahrenheitTenths())/10 - 32) * 5 / 9
	})
}

func main() {
	report("lab", RoomSensor(21.5))
	report("patient", adaptLegacy(LegacyThermometer{986}))
	report("hall", adaptLegacy(LegacyThermometer{704}))
}
Output
lab: 21.5 C
patient: 37.0 C
hall: 21.3 C
  • Verdict: idiom. A function type with a method is the adapter. Any function with the right signature becomes a Thermometer with a conversion, CelsiusFunc(f).
  • net/http uses this form. HandlerFunc(f) is a Handler whose ServeHTTP calls f.
  • Go interfaces are satisfied implicitly. A type from another package that already has a Celsius() float64 method needs no adapter.
RustGitHub
trait Thermometer {
    fn celsius(&self) -> f64;
}

fn report(name: &str, sensor: &dyn Thermometer) {
    println!("{name}: {:.1} C", sensor.celsius());
}

struct RoomSensor(f64);

impl Thermometer for RoomSensor {
    fn celsius(&self) -> f64 {
        self.0
    }
}

// The vendor type. In a real program it is in another crate.
mod vendor {
    pub struct LegacyThermometer {
        tenths: i32,
    }

    impl LegacyThermometer {
        pub fn new(tenths: i32) -> Self {
            LegacyThermometer { tenths }
        }

        pub fn fahrenheit_tenths(&self) -> i32 {
            self.tenths
        }
    }
}

use vendor::LegacyThermometer;

// A newtype: a tuple struct with one field, which wraps the vendor type.
struct LegacyAdapter(LegacyThermometer);

impl Thermometer for LegacyAdapter {
    fn celsius(&self) -> f64 {
        (f64::from(self.0.fahrenheit_tenths()) / 10.0 - 32.0) * 5.0 / 9.0
    }
}

fn main() {
    report("lab", &RoomSensor(21.5));
    report("patient", &LegacyAdapter(LegacyThermometer::new(986)));
    report("hall", &LegacyAdapter(LegacyThermometer::new(704)));
}
Output
lab: 21.5 C
patient: 37.0 C
hall: 21.3 C
  • Verdict: idiom. The adapter is a newtype that owns the vendor value and implements the trait. The Rust book describes this form and states that it has no run-time cost.
  • Here the trait is local, so impl Thermometer for LegacyThermometer would also compile. When both the trait and the type come from other crates, the orphan rule forbids that impl, and the newtype is the way to adapt.
  • f64::from converts the i32 with no loss, because every i32 value fits in an f64. The standard library has no From<i64> for f64, so the compiler rejects the same call for a type that could lose a value.
KotlinGitHub
import java.util.Locale

fun interface Thermometer {
    fun celsius(): Double
}

fun report(name: String, sensor: Thermometer) {
    println(String.format(Locale.ROOT, "%s: %.1f C", name, sensor.celsius()))
}

class RoomSensor(private val value: Double) : Thermometer {
    override fun celsius(): Double = value
}

// The vendor class. The program cannot change it.
class LegacyThermometer(private val tenths: Int) {
    fun fahrenheitTenths(): Int = tenths
}

fun LegacyThermometer.asThermometer(): Thermometer =
    Thermometer { (fahrenheitTenths() / 10.0 - 32) * 5 / 9 }

fun main() {
    report("lab", RoomSensor(21.5))
    report("patient", LegacyThermometer(986).asThermometer())
    report("hall", LegacyThermometer(704).asThermometer())
}
Output
lab: 21.5 C
patient: 37.0 C
hall: 21.3 C
  • Verdict: idiom. Thermometer is a fun interface, so a lambda converts to it with a SAM conversion. The extension function asThermometer returns that lambda as the adapter.
  • The extension function adds no member to LegacyThermometer. It is a static function that the compiler lets the code call with the dot syntax.

Consequences

The client and the adaptee stay as they are. The translation is in one class, so a test can check it with known readings. Another vendor needs another adapter and no change to the client. The client depends on the target interface only, which is what lets the Strategy pattern and the Decorator pattern wrap or swap the adapted object later.

The costs are these.

An adapter can hide a mismatch in meaning. An interface that matches by name and type does not match by meaning. Units, ranges, error codes and time zones must all be translated, and each one is a place for a bug. Here the legacy thermometer returns -9999 when it is offline. An adapter that converts only the units turns that code into a temperature:

This code runs but gives a wrong answer on purpose.

class LegacyThermometer:
    OFFLINE = -9999

    def __init__(self, tenths):
        self.tenths = tenths

    def fahrenheit_tenths(self):
        return self.tenths


class LegacyAdapter:
    def __init__(self, legacy):
        self.legacy = legacy

    def celsius(self):
        return (self.legacy.fahrenheit_tenths() / 10 - 32) * 5 / 9


for tenths in [986, LegacyThermometer.OFFLINE]:
    sensor = LegacyAdapter(LegacyThermometer(tenths))
    print(f"{sensor.celsius():.1f} C")
Output
37.0 C
-573.3 C

The second line, -573.3 C, is below absolute zero. The adapter must also translate the error convention. The adaptee signals an error with a value, and the client expects an exception, so the adapter turns the one into the other:

class SensorOffline(Exception):
    pass


class LegacyThermometer:
    OFFLINE = -9999

    def __init__(self, tenths):
        self.tenths = tenths

    def fahrenheit_tenths(self):
        return self.tenths


class LegacyAdapter:
    def __init__(self, legacy):
        self.legacy = legacy

    def celsius(self):
        tenths = self.legacy.fahrenheit_tenths()
        if tenths == LegacyThermometer.OFFLINE:
            raise SensorOffline("legacy thermometer is offline")
        return (tenths / 10 - 32) * 5 / 9


for tenths in [986, LegacyThermometer.OFFLINE]:
    sensor = LegacyAdapter(LegacyThermometer(tenths))
    try:
        print(f"{sensor.celsius():.1f} C")
    except SensorOffline as error:
        print(f"offline: {error}")
Output
37.0 C
offline: legacy thermometer is offline

An adapter can hide a difference in behaviour. The adapted object can keep rules of the adaptee that the target interface does not show. Java Arrays.asList adapts an array to the List interface. Its documentation states that the list is fixed size and backed by the array. Changes to the list are visible in the array. Methods that would change the size throw UnsupportedOperationException.5 The type List<String> does not say this:

import java.util.Arrays;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        String[] names = {"pen", "book"};
        List<String> list = Arrays.asList(names);
        list.set(0, "ink");
        System.out.println("array after set: " + names[0]);
        try {
            list.add("cup");
        } catch (UnsupportedOperationException error) {
            System.out.println("add: " + error.getClass().getSimpleName());
        }
    }
}
Output
array after set: ink
add: UnsupportedOperationException

A method that takes a List and adds to it fails at run time when a caller passes this list. Copy the list with new ArrayList<>(Arrays.asList(names)) when the receiver needs a list that it owns.

An adapter can hide a cost. A call through an adapter looks as cheap as any call on the target. If the adapter converts a large value, opens a connection, or copies a collection on each call, the client cannot see it. State the cost in the documentation of the adapter.

A class adapter couples to one class. Design Patterns notes that a class adapter cannot adapt the subclasses of the adaptee, while an object adapter can. In return, a class adapter can override methods of the adaptee, and for an object adapter this is harder.1

When not to use it

Do not write an adapter when you own both sides and can change one of them. Change the class so that it has the interface the client needs. An adapter between two classes of the same program is often a sign that one interface is not needed.

Do not write an adapter for a mismatch that is only a name. A function reference, a lambda or a method reference adapts one call in one line. The Kotlin, Go and JavaScript examples show such forms.2038

Do not let one adapter grow to cover a whole subsystem. When the client needs a smaller, simpler interface to many classes, that is a facade, which has a different purpose.16

Do not adapt in many places. Kerievsky's Extract Adapter starts from one class that adapts several versions of a component, with the code for each version mixed together. The fix is one adapter for each version.2

Two-way and pluggable adapters. Design Patterns describes two more forms. A two-way adapter implements both interfaces, so that each side can use it. A pluggable adapter builds the adaptation into the class that needs it, with abstract operations or delegates.1 In languages with first-class functions, a pluggable adapter is often a function parameter.

Newtypes in Rust. Rust has an orphan rule. It allows a trait implementation only if the trait or at least one of the types is defined in the current crate.10 The Rust book shows how to implement an external trait on an external type. It wraps the type in a tuple struct with one field, a newtype, and implements the trait on the wrapper. The book states that the wrapper has no run-time cost.11 This is an object adapter that the compiler removes.

Structural types. TypeScript relates types by their members only.13 A class with the right methods is already a valid target, with no declaration. An adapter is needed only when the names or the types differ.

Container adaptors in C++. The standard library calls stack, queue and priority_queue container adaptors. Each one takes the type of an underlying container as a template parameter and gives it a smaller interface.12 These are class-level adapters fixed at compile time.

Rust iterator adapters. The Rust documentation calls functions that take an iterator and return another iterator iterator adapters, as a form of the adapter pattern.14 They keep the Iterator interface and change the values, so by the definitions of Design Patterns they are closer to decorators.1

Decorator. A decorator keeps the interface and adds behaviour. An adapter changes the interface and keeps the behaviour.1

Bridge. Bridge has a structure like an object adapter, but a different purpose. Bridge separates an abstraction from its implementation when the design starts, so that both can vary. An adapter makes two existing classes work together after the fact.15

Facade. A facade provides one interface to a set of interfaces in a subsystem.16 An adapter converts one interface into another that already exists. A facade defines an interface that did not exist before.

Factory Method. Code that must choose an adapter for each vendor at run time often uses a factory method or a table of constructors. Then the client never names an adapter class.

Known uses

References

  1. Gamma, Helm, Johnson and Vlissides, Design Patterns, Elements of Reusable Object-Oriented Software, Addison-Wesley, 1994, Chapter 4, Adapter (Intent, Also Known As, Motivation, Structure, Consequences, Implementation, Related Patterns)
  2. Joshua Kerievsky, Refactoring to Patterns, Addison-Wesley, 2004, Chapter 8, Generalization, Unify Interfaces with Adapter and Extract Adapter (problem and solution)
  3. Go standard library, package net/http, type HandlerFunc
  4. Java SE 25 API, java.io.InputStreamReader, class description
  5. Java SE 25 API, java.util.Arrays, asList(T...)
  6. The Python Standard Library, contextlib, Python 3.14, contextlib.closing
  7. The Python Standard Library, io, Python 3.14, io.TextIOWrapper
  8. Node.js documentation, Util, util.promisify(original)
  9. .NET API reference, System.IO.StreamReader, class description
  10. The Rust Reference, Implementations, Orphan rules
  11. The Rust Programming Language, Advanced Traits, Implementing External Traits with the Newtype Pattern
  12. Working Draft, Standard for Programming Language C++, N4950, [container.adaptors] Container adaptors
  13. TypeScript Handbook, Type Compatibility, introduction (structural subtyping)
  14. Rust standard library, module std::iter, Adapters
  15. Gamma, Helm, Johnson and Vlissides, Design Patterns, Elements of Reusable Object-Oriented Software, Addison-Wesley, 1994, Chapter 4, Bridge (Intent, Related Patterns)
  16. Gamma, Helm, Johnson and Vlissides, Design Patterns, Elements of Reusable Object-Oriented Software, Addison-Wesley, 1994, Chapter 4, Facade (Intent)
  17. Go go1.27.3 source, src/net/http/server.go, type HandlerFunc and its ServeHTTP method, lines 2350 to 2359
  18. OpenJDK jdk-25+36 source, java/io/InputStreamReader.java, the constructor InputStreamReader(InputStream), lines 81 to 85, and read(char[], int, int), lines 182 to 184
  19. OpenJDK jdk-25+36 source, java/util/Arrays.java, asList and the private class ArrayList, lines 4180 to 4233
  20. Kotlin documentation, Functional (SAM) interfaces, SAM conversions

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/TF9KQ1/text.yaml