← All demos

Two Decorators, One Rule

See how dioxide's two decorators map to clean architecture decisions. @service marks business logic that never changes. @adapter.for_() marks infrastructure that does.

@service for logic. @adapter.for_() for infrastructure.

The Question

Which decorator do I use? @service is for core domain logic that stays the same across all environments. @adapter.for_() is for infrastructure integrations that change per profile (production, test, dev).

The Answer

Business logic does not change between environments. Infrastructure does. @service for the first, @adapter.for_() for the second. Same service code, different adapters per profile.

Source Code

Browse on GitHub