Adapting an Existing Object to Another Interface
An adapter translates how a component is called or what it returns, while preserving the meaning the receiving interface requires.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Trace a record converter
A legacy reader might return coordinate pairs in row-column order. A graph tool expects named coordinates x and y. An adapter can construct the expected record with x from column and y from row. Row and column indices clarify the transformation.
Test a sequence whose coordinates differ
Using row equal to column hides a swap. Supply (2, 7) and verify both resulting fields and units. Inputs that distinguish results identify this kind of verification.[1]