Skip to content

docs: recommend interface + symbol over class tokens for services#17792

Open
sdirix wants to merge 1 commit into
masterfrom
sdirix/guidelines-symbols-classes
Open

docs: recommend interface + symbol over class tokens for services#17792
sdirix wants to merge 1 commit into
masterfrom
sdirix/guidelines-symbols-classes

Conversation

@sdirix

@sdirix sdirix commented Jul 16, 2026

Copy link
Copy Markdown
Member

What it does

This is a proposal to reverse the "classes over interfaces + symbols" coding guideline. For replaceable services (most public services in Theia), we should recommend declaring an interface + symbol with a default implementation, instead of using a concrete class as both the injection token and the type.

A class token forces adopters to subclass the default implementation. Splitting interface and symbol lets adopters choose: subclass the default, or provide a fully independent implementation. It also makes testing easier, since a test double can satisfy the interface directly.

An exception are internal services that are not meant to be extension points, where a plain class as token/type is fine.

How to test

Nothing to test

Follow-ups

  • Align the codebase with the new recommendation

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

Review checklist

Reminder for reviewers

@github-project-automation github-project-automation Bot moved this to Waiting on reviewers in PR Backlog Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting on reviewers

Development

Successfully merging this pull request may close these issues.

1 participant