← Graph

Service Object

concept 7 connections

Long-standing Rails pattern Krzywda once advocated and calls a 'gateway drug' to DDD. Known under many names (service, command, operation, action, interactor, scenario) and spawns endless team debates: call vs execute, return value (nothing, last changed record, boolean, Result/Success/Failure, exceptions), grouping (UserService with register/delete methods vs RegisterUser class), calling other services, testing with mocks vs full integration, and params-driven flow. In The Curse of Service Object, Ivan Nemytchenko argues the shape has no philosophical justification: developers use the name for many unrelated kinds of work (validation, creation, mutation, notification, external-API wrappers, authentication); the three OOP pillars (encapsulation, inheritance, polymorphism) don't justify object shape; there's no lifecycle, state, or need for multiple simultaneous instances. The only real benefit he concedes is moving code out of controllers, and even that is partially undone as services proactively steal controller responsibilities. In Krzywda's layered architecture, service objects collapse into thin mappers from form/controller params to commands dispatched at domain boundaries. Should never be reused across applications.

category
pattern
about
Service Object concept
Revisits service objects and collapses them into param-to-command mappers.
about
Service Object concept
Takeaway about the new role of service objects.
about
Service Object concept
Question about service object composition.
about
Service Object concept
Call-graph walkthrough cites service objects as the first legitimate layered step in the Rails architectural evolution, echoing Krzywda's 'gateway drug' framing.
about
Service Object concept
The talk's central subject is the Rails service-object pattern.
about
Service Object concept
Listed among community-invented Rails abstractions not backed by Rails philosophy
related_to
Service Object concept
Ivan's stateless procedural services replace stateful service objects.

Provenance

Read by
8 extractions