# interface implementation

Interface implementation is the programmer-supplied code that carries out the actions specified by an interface definition.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## To code well, avoid blunders

DevFeed: [To code well, avoid blunders](<https://devfeed.tech/articles/to-code-well-avoid-blunders-147621.md>)

Original publisher: [Read original article](<https://seangoedecke.com/to-code-well-avoid-blunders/>)

Published: 2026-11-22T00:00:00Z

Content type: opinion

Language: en

Sources: [Sean Goedecke](<https://devfeed.tech/sources/seangoedecke-com-rss-feed.md>)

Topics: [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>), [trust](<https://devfeed.tech/topics/trust.md>)

Tags: [abstractions](<https://devfeed.tech/tags/abstractions.md>), [async](<https://devfeed.tech/tags/async.md>), [avoid](<https://devfeed.tech/tags/avoid.md>), [basketball](<https://devfeed.tech/tags/basketball.md>), [build](<https://devfeed.tech/tags/build.md>), [chess](<https://devfeed.tech/tags/chess.md>), [code](<https://devfeed.tech/tags/code.md>), [failure](<https://devfeed.tech/tags/failure.md>), [mistakes](<https://devfeed.tech/tags/mistakes.md>), [parallel](<https://devfeed.tech/tags/parallel.md>), [programming](<https://devfeed.tech/tags/programming.md>), [requirements](<https://devfeed.tech/tags/requirements.md>), [secret](<https://devfeed.tech/tags/secret.md>), [source](<https://devfeed.tech/tags/source.md>), [source-of-truth](<https://devfeed.tech/tags/source-of-truth.md>), [sticky](<https://devfeed.tech/tags/sticky.md>), [sync](<https://devfeed.tech/tags/sync.md>), [tennis](<https://devfeed.tech/tags/tennis.md>), [trust](<https://devfeed.tech/tags/trust.md>), [well](<https://devfeed.tech/tags/well.md>)

### AI overview

In large commercial codebases, good programming depends more on avoiding costly blunders than on clever abstractions. The article flags duplicate systems or sources of truth, turning safe synchronous work into delicate asynchronous work, adding subtle failure points, and complicating key interfaces. Inconsistency erodes engineers' trust, while unnecessary requirements persist and interact, making future changes harder. To reduce these risks, fit work into the codebase's existing patterns and narrow it to the smallest necessary set of requirements. The author says this advice applies to work by hand and with AI agents, and may not fit other kinds of work; coding agents are described as comparatively weaker at avoiding unnecessary requirements.

### Source excerpt

The secret to writing good code1 is to avoid catastrophic mistakes. Many engineers think about programming as if the goal is to have brilliant insights, but they're wrong. If you don't blunder, you will win. Many other domains are like this. If you can play chess without ever hanging pieces, you will win against almost any2 opponent. If you are very good at returning tennis balls, you will beat most players even if you never hit a winner. People are really bad at internalizing this. They think that being good at chess means finding brilliant tactical combinations, or that being good at tennis means crushing balls into the corner of the court, or that being a good programmer means discovering beautiful new abstractions. Not so! All of those things are valuable, but they are not the main thing. The main thing is to avoid catastrophic mistakes. The reason programming is like this is that it is impossible to build a durable winning advantage. In basketball, if you are up 99-1, the worst consequence of a blunder is still being up 99-4. However, in programming, one blunder can turn an elegant codebase into a janky one. For instance, consider these blunders: Introducing a parallel system to perform the same task Introducing a second source of truth for some key piece of data Turning a safe sync operation into a delicate async one Adding new subtle points of failure Complicating a key interface The cardinal sins here are inconsistency and introducing unnecessary requirements3. Even a little bit of inconsistency is dangerous because it breaks trust: instead of assuming your code works the sensible way, engineers must now go looking for surprises. Unnecessary requirements are dangerous for two reasons. First, they're sticky. When you're implementing a new requirement, you have the context to decide whether it's necessary or not. If you see one in the codebase, you must assume it's necessary unless you're willing to spend a bunch of time researching. So requirements tend to re

## C++/WinRT overcorrection: Using make\_self and immediately converting it to the projected interface

DevFeed: [C++/WinRT overcorrection: Using make\_self and immediately converting it to the projected interface](<https://devfeed.tech/articles/c-winrt-overcorrection-using-make-self-and-immediately-converting-it-to-the-projected-interface-105914.md>)

Original publisher: [Read original article](<https://devblogs.microsoft.com/oldnewthing/20261028-00/?p=112803/>)

Author: Raymond Chen

Published: 2026-10-28T14:00:00Z

Content type: article

Language: en

Sources: [Raymond Chen](<https://devfeed.tech/sources/raymond-chen.md>)

Topics: [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>), [interface](<https://devfeed.tech/topics/interface.md>)

Tags: [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [code](<https://devfeed.tech/tags/code.md>), [old-new-thing](<https://devfeed.tech/tags/old-new-thing.md>), [projection](<https://devfeed.tech/tags/projection.md>), [windows](<https://devfeed.tech/tags/windows.md>)

### AI overview

C++/WinRT offers two creation paths for objects you implement. `make<Impl>` returns the projected Windows Runtime object; use `get_self<Impl>` if you later need implementation-only members. `make_self<Impl>` returns a `winrt::com_ptr<Impl>`, letting you access those members first and convert to the projection with `*`. Choose based on what you need to do first: use `make_self` for setup through implementation members, but when you only need the projection, return it directly from `make_self` rather than creating a pointer and converting it separately.

### Source excerpt

You are taking the scenic route. The post C++/WinRT overcorrection: Using <CODE>make_self</CODE> and immediately converting it to the projected interface appeared first on The Old New Thing.

## Implementation of the HDA Link interface on RP2040

DevFeed: [Implementation of the HDA Link interface on RP2040](<https://devfeed.tech/articles/implementation-of-the-hda-link-interface-on-rp2040-100708.md>)

Original publisher: [Read original article](<https://blog.adafruit.com/2026/10/26/implementation-of-the-hda-link-interface-on-rp2040/>)

Author: Anne Barela

Published: 2026-10-26T19:08:40Z

Content type: article

Language: en

Sources: [Adafruit Industries](<https://devfeed.tech/sources/adafruit-industries-makers-hackers-artists-designers-and-engineers.md>)

Topics: [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>)

Tags: [audio](<https://devfeed.tech/tags/audio.md>), [codec](<https://devfeed.tech/tags/codec.md>), [dac](<https://devfeed.tech/tags/dac.md>), [driving](<https://devfeed.tech/tags/driving.md>), [fpga](<https://devfeed.tech/tags/fpga.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [intel](<https://devfeed.tech/tags/intel.md>), [interface](<https://devfeed.tech/tags/interface.md>), [post](<https://devfeed.tech/tags/post.md>), [rp2040](<https://devfeed.tech/tags/rp2040.md>), [sound](<https://devfeed.tech/tags/sound.md>), [timing](<https://devfeed.tech/tags/timing.md>), [uses](<https://devfeed.tech/tags/uses.md>)

### AI overview

An RP2040 can drive an Intel HDA (Azalia) codec directly, without a chipset or FPGA, using its PIO blocks to meet the link's tight timing. HDA uses four wires and supports up to 15 channels in each direction. The implementation assigns separate PIO state machines to SDO, SYNC, and SDI (which also generates BCLK), plus a fourth to set the codec's bus address at startup. Core 1 packs and unpacks samples because audio data is not aligned to 32-bit boundaries. The demo drives all 10 DAC channels of an ALC889 with 192 kHz sine waves; overclocking to a 32 MHz BCLK enabled 256 kHz sampling, but the codec became hot. The excerpt does not provide the full implementation details.

### Source excerpt

A post on habr.com documents an RP2040 driving an Intel High Definition Audio codec directly, with no chipset and no FPGA. HDA, also called Azalia, uses four wires and supports up to 15 channels in and 15 out, well past the two in, two out that I²S usually gives you. The hard part is timing. [...]

## The Evolution of Statics: Say Goodbye to Kotlin Companion Objects?

DevFeed: [The Evolution of Statics: Say Goodbye to Kotlin Companion Objects?](<https://devfeed.tech/articles/the-evolution-of-statics-say-goodbye-to-kotlin-companion-objects-85014.md>)

Original publisher: [Read original article](<https://proandroiddev.com/the-evolution-of-statics-say-goodbye-to-kotlin-companion-objects-dbe625b92896?source=rss-711ab22c5c77------2>)

Author: Nav Singh

Published: 2026-10-11T02:28:53Z

Content type: tutorial

Language: en

Sources: [Nav Singh](<https://devfeed.tech/sources/stories-by-nav-singh-on-medium.md>)

Topics: [extension property](<https://devfeed.tech/topics/extension-property.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [class](<https://devfeed.tech/topics/class.md>), [Object-oriented programming (OOP)](<https://devfeed.tech/topics/oop.md>), [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>)

Tags: [androiddev](<https://devfeed.tech/tags/androiddev.md>), [block](<https://devfeed.tech/tags/block.md>), [blocks](<https://devfeed.tech/tags/blocks.md>), [bytecode](<https://devfeed.tech/tags/bytecode.md>), [class](<https://devfeed.tech/tags/class.md>), [classes](<https://devfeed.tech/tags/classes.md>), [companion](<https://devfeed.tech/tags/companion.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [cross](<https://devfeed.tech/tags/cross.md>), [extension](<https://devfeed.tech/tags/extension.md>), [extensions](<https://devfeed.tech/tags/extensions.md>), [factory](<https://devfeed.tech/tags/factory.md>), [implement](<https://devfeed.tech/tags/implement.md>), [interface](<https://devfeed.tech/tags/interface.md>), [interop](<https://devfeed.tech/tags/interop.md>), [java](<https://devfeed.tech/tags/java.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [memory](<https://devfeed.tech/tags/memory.md>), [module](<https://devfeed.tech/tags/module.md>), [new-features](<https://devfeed.tech/tags/new-features.md>), [overhead](<https://devfeed.tech/tags/overhead.md>), [static](<https://devfeed.tech/tags/static.md>)

### AI overview

The excerpt presents Kotlin 2.5.0-Beta1 companion blocks and companion extensions as experimental alternatives to companion objects. Companion blocks compile members directly as static bytecode on the parent class, allowing Java calls such as `User.createDefault()` without `@JvmStatic`; unlike companion objects, they cannot implement interfaces because they are not objects. Companion extensions add static-like members to a type from outside its declaration, with examples including third-party factories, configuration initializers, and domain constants; regular extension functions instead operate on instances. Trying the preview requires the JetBrains Bootstrap Repository, Kotlin 2.5.0-Beta1, JVM toolchain 21, and the `-Xcompanion-blocks` and `-Xcompanion-blocks-and-extensions` compiler flags.

### Source excerpt

AI generated image For years, we used companion object to group class-level members (constants, factory methods). However, companion objects are actual object singletons under the hood. This introduces memory overhead and causes friction when interoperating with Java (requiring @JvmStaticannotations). data class User(val name: String, val age: Int) { companion object { @JvmStatic fun createDefault(): User = User("Guest", 18) } }AI generated imageKotlin 2.5 introduces companion blocks and companion extensions: Companion Blocks: Drop the object keyword. On the JVM, they compile down directly into high-performance native static members. Companion Extensions: Let us attach new static-like methods or properties to any class from the outside, even classes inside external dependencies or standard Java SDKs we don't control. Companion Blocks vs. Companion Objects Under the Hood: A companion object creates a nested singleton subclass instantiation. A companion block compiles directly to static bytecode members on the parent class. Interface Limitation: Companion objects are still required if static-scoped layer needs to implement an interface. Companion blocks cannot implement interfaces because they are not real objects. Java Interop: Java code can call companion block members directly via User.createDefault(). Companion objects still require User.Companion.createDefault() unless decorated with @JvmStatic. Companion Extensions vs. Regular Extension Functions Call Site: Regular extensions require an existing instance (userInstance.isValid()). Companion extensions are invoked statically on the type itself (User.systemAdmin()). Use Cases: Regular extensions add instance operations (mapping, filtering, etc.). Companion extensions serve as third-party factories, cross-module configuration initializers, or domain constants. Implementation🛠 Setting Up the project Companion Blocks and Extensions are arriving as experimental features in Kotlin 2.5.0-Beta1 To try this out today, we

## We're rolling out AlphaEvolve widely to solve Google Cloud customers' hardest problems.

DevFeed: [We're rolling out AlphaEvolve widely to solve Google Cloud customers' hardest problems.](<https://devfeed.tech/articles/we-re-rolling-out-alphaevolve-widely-to-solve-google-cloud-customers-hardest-problems-89316.md>)

Original publisher: [Read original article](<https://blog.google/innovation-and-ai/infrastructure-and-cloud/google-cloud/alphaevolve-on-cloud/>)

Author: Tom Beyer

Published: 2026-07-09T16:00:00Z

Content type: news

Language: en

Sources: [Developer tools](<https://devfeed.tech/sources/developer-tools.md>), [Google Cloud](<https://devfeed.tech/sources/google-cloud.md>)

Topics: [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>), [Google AI](<https://devfeed.tech/topics/google-ai.md>), [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [designing](<https://devfeed.tech/tags/designing.md>), [developer-tools](<https://devfeed.tech/tags/developer-tools.md>), [gemini](<https://devfeed.tech/tags/gemini.md>), [google](<https://devfeed.tech/tags/google.md>), [google-cloud](<https://devfeed.tech/tags/google-cloud.md>), [google-deepmind](<https://devfeed.tech/tags/google-deepmind.md>), [jetbrains](<https://devfeed.tech/tags/jetbrains.md>), [none](<https://devfeed.tech/tags/none.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [organizations](<https://devfeed.tech/tags/organizations.md>)

### AI overview

Google has made AlphaEvolve, a Gemini-powered AI code-optimization agent, generally available to Google Cloud customers through Gemini Enterprise Agent Platform. It searches for improved solutions from a baseline algorithm and stated goals, then returns optimized code. Google says early adopters including BASF, JetBrains and Kinaxis used it on business and research problems.

### Source excerpt

Finding the most efficient algorithm -- whether designing a microchip, routing a logistics network or accelerating medical research -- can be challenging, with many possib...

## How we made GitHub Actions cache up to 6x faster

DevFeed: [How we made GitHub Actions cache up to 6x faster](<https://devfeed.tech/articles/how-we-made-github-actions-cache-up-to-6-faster-122852.md>)

Original publisher: [Read original article](<https://avrea.com/blog/how-we-made-github-actions-cache-up-to-6x-faster>)

Author: Leo Lännenmäki

Published: 2026-05-21T00:00:00Z

Content type: article

Language: en

Sources: [Avrea Blog](<https://devfeed.tech/sources/avrea-blog.md>)

Topics: [Cache](<https://devfeed.tech/topics/cache.md>), [GitHub Actions](<https://devfeed.tech/topics/github-actions.md>), [Architecture & optimization](<https://devfeed.tech/topics/architecture-optimization.md>), [self-hosted runner](<https://devfeed.tech/topics/self-hosted-runner.md>), [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>)

Tags: [1-5](<https://devfeed.tech/tags/1-5.md>), [2](<https://devfeed.tech/tags/2.md>), [3](<https://devfeed.tech/tags/3.md>), [actions](<https://devfeed.tech/tags/actions.md>), [all](<https://devfeed.tech/tags/all.md>), [also](<https://devfeed.tech/tags/also.md>), [api](<https://devfeed.tech/tags/api.md>), [azure](<https://devfeed.tech/tags/azure.md>), [backend](<https://devfeed.tech/tags/backend.md>), [cache](<https://devfeed.tech/tags/cache.md>), [client](<https://devfeed.tech/tags/client.md>), [faster](<https://devfeed.tech/tags/faster.md>), [github](<https://devfeed.tech/tags/github.md>), [github-actions](<https://devfeed.tech/tags/github-actions.md>), [restore](<https://devfeed.tech/tags/restore.md>), [takes](<https://devfeed.tech/tags/takes.md>), [up](<https://devfeed.tech/tags/up.md>), [variance](<https://devfeed.tech/tags/variance.md>), [with](<https://devfeed.tech/tags/with.md>), [workflow](<https://devfeed.tech/tags/workflow.md>)

### AI overview

Avrea reports that its GitHub Actions cache restores are up to 6x faster than GitHub-hosted restores, with less variation on larger entries. The comparison measures end-to-end `actions/cache/restore` step duration, including transfer, decompression, and file I/O; each reported value is the median of 50 runs. Avrea achieves compatibility without changing the workflow or cache client: a local Go proxy implements the required Twirp and Azure blob operations, verifies GitHub-signed runtime tokens, and routes other traffic to GitHub. Co-located API and storage reduce network round trips, while faster runner machines help with transfer and processing. Small caches see smaller gains because request overhead dominates. The approach must preserve GitHub's branch and repository access rules, and the post notes `actions/cache` is less suited to caching many small entries.

### Source excerpt

On GitHub Actions, a 1 GB actions/cache restore takes 14 seconds. On Avrea, the same workflow, same client: 2.9 seconds. Up to 6x faster across cache sizes from 1 KB to 1 GB, with 3x tighter variance.

## Server Actions with Toast (useActionState)

DevFeed: [Server Actions with Toast (useActionState)](<https://devfeed.tech/articles/server-actions-with-toast-useactionstate-18976.md>)

Original publisher: [Read original article](<https://www.robinwieruch.de/react-server-actions-toast-useactionstate/>)

Author: Robin Wieruch

Published: 2025-03-06T06:51:46Z

Content type: tutorial

Language: en

Sources: [Robin Wieruch](<https://devfeed.tech/sources/robin-wieruch.md>)

Topics: [notifications](<https://devfeed.tech/topics/notifications.md>), [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>), [Back end](<https://devfeed.tech/topics/backend.md>)

Tags: [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [next-js](<https://devfeed.tech/tags/next-js.md>), [notifications](<https://devfeed.tech/tags/notifications.md>), [react](<https://devfeed.tech/tags/react.md>), [react-server-action-toast-useactionstate](<https://devfeed.tech/tags/react-server-action-toast-useactionstate.md>), [server-actions](<https://devfeed.tech/tags/server-actions.md>), [toast](<https://devfeed.tech/tags/toast.md>)

### AI overview

The tutorial's approach is to wrap a React Server Action in a higher-order function that forwards its arguments and promise result, then accepts success and error callbacks to trigger toast handling when the action completes. It builds reusable utilities for use with React's useActionState; the excerpt ends while explaining callback implementation, so it does not provide the complete code or later details. It also mentions next-safe-action as an option for readers who do not want to build the utilities themselves.

### Source excerpt

Learn how to display toast notifications from React Server Actions in React (and Next.js) with useActionState ...

## Interfaces 101 : Interface Design Considerations Ep. 7

DevFeed: [Interfaces 101 : Interface Design Considerations Ep. 7](<https://devfeed.tech/articles/interfaces-101-interface-design-considerations-ep-7-22217.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/03/interfaces-101-interface-design-considerations.html>)

Published: 2023-03-13T00:00:00Z

Content type: article

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [interface](<https://devfeed.tech/topics/interface.md>), [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>)

Tags: [abstraction](<https://devfeed.tech/tags/abstraction.md>), [functions](<https://devfeed.tech/tags/functions.md>), [go](<https://devfeed.tech/tags/go.md>), [golang](<https://devfeed.tech/tags/golang.md>), [interface-design](<https://devfeed.tech/tags/interface-design.md>), [io-copy-function](<https://devfeed.tech/tags/io-copy-function.md>), [io-interfaces](<https://devfeed.tech/tags/io-interfaces.md>), [io-reader](<https://devfeed.tech/tags/io-reader.md>), [io-writer](<https://devfeed.tech/tags/io-writer.md>), [polymorphism](<https://devfeed.tech/tags/polymorphism.md>)

### AI overview

The episode presents Go interfaces as statements of what code needs, rather than what an implementation provides. It uses io.Reader and io.Writer to illustrate interfaces describing required reading and writing behavior, and offers a design heuristic: interfaces with more than five functions may indicate a problem, echoing the proverb "the bigger the interface, the weaker the abstraction." The excerpt also recalls an earlier logger example using type assertions to retrieve interface types and demonstrate polymorphism.

### Source excerpt

Introduction In episode 6, Miki built a logger package with the aim of making it as versatile as possible. To achieve this, he constructed his logger object with a function that would: accept the io.Writer interface as a parameter and perform type assertions to retrieve other interface types as needed. By building this, Miki demonstrated how polymorphism is achieved with Go by changing the type of a variable with type assertions.

## Interfaces 101 : Determine LOC with io.Writer Ep. 5

DevFeed: [Interfaces 101 : Determine LOC with io.Writer Ep. 5](<https://devfeed.tech/articles/interfaces-101-determine-loc-with-io-writer-ep-5-22212.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/02/interfaces-101-determine-loc-with-iowriter.html>)

Published: 2023-02-27T00:00:00Z

Content type: article

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>), [interface](<https://devfeed.tech/topics/interface.md>)

Tags: [file](<https://devfeed.tech/tags/file.md>), [function](<https://devfeed.tech/tags/function.md>), [go](<https://devfeed.tech/tags/go.md>), [golang](<https://devfeed.tech/tags/golang.md>), [implement](<https://devfeed.tech/tags/implement.md>), [interface-implementation](<https://devfeed.tech/tags/interface-implementation.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [io](<https://devfeed.tech/tags/io.md>), [stringer](<https://devfeed.tech/tags/stringer.md>), [type](<https://devfeed.tech/tags/type.md>), [type-alias](<https://devfeed.tech/tags/type-alias.md>), [variable](<https://devfeed.tech/tags/variable.md>), [writer](<https://devfeed.tech/tags/writer.md>)

### AI overview

The excerpt describes a Go demonstration that uses io.Writer to count lines in a file. Miki first assigns a value returned by a package function to a variable because its concrete type satisfies the interface. He then defines an alias of a primitive type and implements the methods needed for that type to satisfy the interface, before passing a variable as an interface value to a function. The excerpt also recalls an earlier fmt.Stringer example, where using the receiver's value inside String caused recursion. It does not provide the full implementation or further details of the line-counting function.

### Source excerpt

Introduction In episode 4, Miki defined an enumerated type that satisfied Go's fmt.Stringer interface. By implementing the fmt.Stringer interface, Miki can specify how his enumerators were printed within a formatted string and in this case, he expected the values to be displayed as a predetermined text value. Miki also pointed out how using the value of the method's receiver within the Stringer method can result in a recursive loop.

## Interfaces 101 : Go's Logging Interface Ep. 4

DevFeed: [Interfaces 101 : Go's Logging Interface Ep. 4](<https://devfeed.tech/articles/interfaces-101-go-s-logging-interface-ep-4-22214.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/02/interfaces-101-go-logging-interface.html>)

Published: 2023-02-21T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [interface](<https://devfeed.tech/topics/interface.md>), [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>), [enum](<https://devfeed.tech/topics/enum.md>), [data type](<https://devfeed.tech/topics/data-type.md>)

Tags: [enumerators](<https://devfeed.tech/tags/enumerators.md>), [formatting](<https://devfeed.tech/tags/formatting.md>), [go](<https://devfeed.tech/tags/go.md>), [golang](<https://devfeed.tech/tags/golang.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [log-interface](<https://devfeed.tech/tags/log-interface.md>), [pretty-printing](<https://devfeed.tech/tags/pretty-printing.md>), [server-logs](<https://devfeed.tech/tags/server-logs.md>), [type](<https://devfeed.tech/tags/type.md>)

### AI overview

The video demonstrates how to control the printed representation of a Go type by implementing Go's formatting interface. Miki defines a user-defined enumerated type for keys, then adds the required method to determine how its values are formatted as strings. The excerpt also links this to an earlier example: returning a nil pointer as a concrete custom error type can produce a non-nil error interface, illustrating why the variable's interface type matters.

### Source excerpt

Introduction In episode 3, Miki implemented a type that satisfied Go's error interface. The odd thing about his type was it would be considered not-nil although no value was set for it. To get a better understanding of the situation, Miki gives a brief explanation of how Go determines if an error value is nil, and in this case, Miki specified the type of the variable returned to be a pointer of his custom error type which blindsided Go's mechanism to determine a nil value. Miki chose this example because it demonstrated the importance of declaring an error with its type set as the error interface.

## Under the hood of Kotlin Class Delegation

DevFeed: [Under the hood of Kotlin Class Delegation](<https://devfeed.tech/articles/under-the-hood-of-kotlin-class-delegation-25974.md>)

Original publisher: [Read original article](<https://medium.com/snapp-mobile/under-the-hood-of-kotlin-class-delegation-24d53f9aa924?source=rss-8efc0359e234------2>)

Author: Jossi Wolf

Published: 2019-04-09T13:20:12Z

Content type: article

Language: en

Sources: [Jossi Wolf](<https://devfeed.tech/sources/stories-by-jossi-wolf-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [class](<https://devfeed.tech/topics/class.md>), [superclass](<https://devfeed.tech/topics/superclass.md>), [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>), [Boilerplate](<https://devfeed.tech/topics/boilerplate.md>), [adapter pattern](<https://devfeed.tech/topics/adapter-pattern.md>), [Image](<https://devfeed.tech/topics/image.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [bytecode](<https://devfeed.tech/tags/bytecode.md>), [class](<https://devfeed.tech/tags/class.md>), [composition-over-inheritance](<https://devfeed.tech/tags/composition-over-inheritance.md>), [delegation](<https://devfeed.tech/tags/delegation.md>), [hood](<https://devfeed.tech/tags/hood.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [inheritance](<https://devfeed.tech/tags/inheritance.md>), [interface](<https://devfeed.tech/tags/interface.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [logic](<https://devfeed.tech/tags/logic.md>), [stories](<https://devfeed.tech/tags/stories.md>)

### AI overview

Kotlin class delegation can expose an API through a class without filling that class with proxy calls. In the example, a custom view delegates an interface's methods to a separate implementation using Kotlin's `by` keyword, keeping the logic extracted and the view less cluttered. The excerpt explains that Kotlin generates functions that invoke the delegate; with many methods, this generated code adds to compiled size even as it reduces clutter in the source.

### Source excerpt

I was told to add an image to the post, so here's one Photo by Jf Brou from Unsplash. Bonus points since Samoyeds are some of the cutest dogs out there! A piece of rather popular advice heard in software development is "favour composition over inheritance". I won't go into the details of why as there is an excellent chapter in "Effective Java" about it, as well as this nice article by Eric Lin. This article explores how class delegation can be useful and how it works under the hood. In our case, we had a custom view which should expose an interface looking like this: https://medium.com/media/2efb0d0125ffec7f388ee2df190bcf6a/href Now it was time to create the CanvasCapabilities implementation. https://medium.com/media/3d8b72ac99b28b99f39c95c882a69dce/href Of course, we don't want to start putting logic into our view just for the sake of exposing the interface through it, which meant that the view now had to act as a "proxy" (implementing the interface and calling the ArtboardCanvas ): https://medium.com/media/f3d51d082e7f23d725ef7efafb3fe131/href Not a nice solution, but at least we extracted the logic. The view was still cluttered though :( Class Delegation to the rescue Using the by keyword in Kotlin, properties and even classes can be delegated. You might know it from using lazy : https://medium.com/media/cbea2e6d1363f31e28552d9a8c87823e/href You can also delegate inheritance, which is what we are after. The usage looks like this: https://medium.com/media/5482d423d1b2a0fcff239f25c4ab31e9/href This delegates the methods from CanvasCapabilities to ArtboardCanvas . No more cluttering with "proxy" calls! Under The Hood Under the hood, Kotlin actually doesn't do any "black magic": It just generates a function which invokes the delegate. The bytecode, decompiled to Java looks like this: https://medium.com/media/34cf5d85a4bcf122bc98d74425e9a5dd/href If you have a lot of methods, that code will still be generated and adding to your compiled code's size, but at least it do

## Interface Values Are Valueless

DevFeed: [Interface Values Are Valueless](<https://devfeed.tech/articles/interface-values-are-valueless-22133.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2018/03/interface-values-are-valueless.html>)

Published: 2018-03-23T00:00:00Z

Content type: article

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [interface](<https://devfeed.tech/topics/interface.md>), [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>), [data type](<https://devfeed.tech/topics/data-type.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>)

Tags: [abstraction](<https://devfeed.tech/tags/abstraction.md>), [algorithms](<https://devfeed.tech/tags/algorithms.md>), [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [behavior](<https://devfeed.tech/tags/behavior.md>), [blog](<https://devfeed.tech/tags/blog.md>), [change](<https://devfeed.tech/tags/change.md>), [code](<https://devfeed.tech/tags/code.md>), [concrete](<https://devfeed.tech/tags/concrete.md>), [cost](<https://devfeed.tech/tags/cost.md>), [data](<https://devfeed.tech/tags/data.md>), [data-transformation](<https://devfeed.tech/tags/data-transformation.md>), [deal](<https://devfeed.tech/tags/deal.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [design](<https://devfeed.tech/tags/design.md>), [effectively](<https://devfeed.tech/tags/effectively.md>), [file](<https://devfeed.tech/tags/file.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [interface](<https://devfeed.tech/tags/interface.md>), [mechanical-sympathy](<https://devfeed.tech/tags/mechanical-sympathy.md>), [memory](<https://devfeed.tech/tags/memory.md>), [network](<https://devfeed.tech/tags/network.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

The article argues that Go interface design should focus on behavior and its relationship to concrete data, rather than implementation details. It favors Data Oriented Design: treat programs and functions as data transformations, and understand the data before choosing how to transform it. Because changing data changes the problem and its algorithms, the author argues for keeping transformations small and precise instead of relying on layers of abstraction and generalization to absorb change. The excerpt ends as the article begins a concrete example, so it does not show how that example applies the argument.

### Source excerpt

Introduction I've been seeing a lot of question about interfaces lately on Slack. Most of the time the answers are technical and focus on implementation details. Implementation is important to help with debugging, but implementation doesn't help with design. When it comes to designing code with interfaces, behavior has to be the main focus. In this post, I hope to provide a different way to think about interfaces and how to design code with them. I want you to stop focusing on the implementation details and focus on the relationship interfaces have with concrete data.