E-Ink News Daily

← Back to list

Avoid Public Functions Calling Other Public Functions

The article proposes a design guideline: when two public functions share implementation logic, extract that logic into a private helper function rather than having one public function call another. This prevents public APIs from accumulating optional parameters intended only for internal reuse, keeping external interfaces clean. An exception exists for shortcut APIs that deliberately chain public functions together.

Background

The author, Aleksandr Gurevich (matklad), is a well-known Rust contributor and creator of rust-analyzer. This article presents a practical rule of thumb for API surface design, relevant to any language with explicit public/private visibility modifiers.

Source
Lobsters
Published
Nov 1, 2026 at 02:05 AM
Score
5.0 / 10