Learning

Core Ideas

Similar Code Can Have Different Owners

Share common authority while preserving independent wording.

Downloads

The preview and archive both display “Registration open.” The preview owner now wants a warmer invitation. The archive must keep its historical wording.

Elsewhere, badges and manifests both use the organization's official identifier format. That format changes, and both consumers must follow it.

Pair Reason to Change Desired Reach
Preview and archive wording Different presentation purposes Change preview alone.
Badge and manifest identifiers One shared policy Change both identifiers.

The code looks similar in both cases. The ownership relationship is different. Coupling means a change in one part can require or cause a change elsewhere; some coupling is intended.

Independent wording decisions. Preview and archive wording follow separate owners.Independent wording decisions. Preview and archive wording follow separate owners.
Shared identifier policy. Badge and manifest identifiers both follow one authoritative rule.Shared identifier policy. Badge and manifest identifiers both follow one authoritative rule.
Engineering Depth

Two small leaves can preserve independent wording:

fn preview_label() -> &'static str { "Join the workshop" }
fn archive_label() -> &'static str { "Registration open" }

Compare that with both callers using one changed registration_label(): the archive would change accidentally. Adding an is_archive flag solely to keep the helper can make the helper own a decision that belongs to its callers.

The official identifier is different:

fn official_id(number: u32) -> String {
    format!("W-{number:04}")
}

Badge and manifest can both call this one owned rule. They need not share their layout, storage or deployment just because they share identifier policy.

Your Reflection

The badge layout changes. Must the manifest layout or identifier policy change too?

Worked Discussion

No, unless that is part of the requirement. Sharing one rule does not make every surrounding choice jointly owned. Conversely, if the official identifier changes, both intended consumers must follow it. Explain the owner and reason for the change before counting duplicate lines.

Navigation