← Graph

The Curse of Service Object

talk 24 connections

Ivan Nemytchenko's wroclove.rb 2024 single-speaker talk. Argues service objects are a 'strange, controversial and harmful' abstraction that contradicts layered architecture, modularity and the single responsibility principle. Structure: (1) introduces his 'OOP in Pictures' visual ontology (objects as little dudes with robo-arms and fingers, classes as spawning platforms with cartridges) to expose antipatterns visually; (2) surveys ~a dozen developer articles and finds service objects claimed to improve maintainability, testability, modularity and SRP, but in practice just 'do stuff' — validations, entity creation, mutations, mailer calls, external API wrappers, authentication logic; (3) constructs a 'service ruler' from Martin Fowler's Service Layer (Patterns of Enterprise Application Architecture), Eric Evans' Domain Services (DDD), and Robert Martin's Clean Code service notes — stateless, named for an activity, represent business domain operations, coordinate domain objects, control transactions, comply with SRP, have side effects — and measures each example, finding none satisfy the rules; (4) shows real GitLab service objects growing inward over time into 200-line monsters, inheriting from BaseService, stealing controller responsibilities, mixing application and domain logic, calling other services and forming circular dependencies; (5) proposes giving each kind of work its own shelf: business rules in the model, low-level creation logic in a Mutator layer, external-system interaction in a Manager layer, business operations as procedural (stateless) services of one high-level abstraction, and application logic (permissions, session, response prep) kept in the controller. Walks through refactoring an authentication service, plus the six opening examples, into this layered shape. Closes that this achieves real modularity, layered architecture and SRP with smaller, simpler building blocks. Q&A covers over-engineering risk, when to use OOP vs procedural, the interactor gem, real-world application, and relation to his unfinished Painless Rails book.

date
2024-03-22
type
talk
talk The Curse of Service Object
about
Service Object concept
The talk's central subject is the Rails service-object pattern.
talk The Curse of Service Object
about
OOP in Pictures concept
Ivan introduces and uses his OOP in Pictures method throughout the talk.
talk The Curse of Service Object
about
Service Layer concept
Talk analyzes Fowler's Service Layer as a source for the 'service ruler'.
talk The Curse of Service Object
about
Domain Service concept
Talk analyzes Evans' Domain Service as a source for the 'service ruler'.
talk The Curse of Service Object
about
Ivan discusses Fowler's book as a primary source on service layers.
talk The Curse of Service Object
about
Clean Code resource
Ivan extracts Robert Martin's comments on services and SRP from Clean Code.
talk The Curse of Service Object
about
SRP (single reason to change) is a core measure in the talk's service ruler.
talk The Curse of Service Object
about
Mutator Layer concept
Ivan proposes the Mutator layer as the right shelf for complex creation/edit/delete procedures.
talk The Curse of Service Object
about
Manager Layer concept
Ivan proposes the Manager layer for encapsulating external-system interactions.
talk The Curse of Service Object
about
The talk advocates stateless procedural services as the replacement for stateful service objects.
talk The Curse of Service Object
about
Ivan stresses keeping application logic (permissions, session, response prep) out of services.
talk The Curse of Service Object
about
GitLab company
Examples of real-world service objects are drawn from GitLab's open-source Rails codebase.
talk The Curse of Service Object
about
interactor tool
In Q&A Ivan recommends against using the interactor gem.
asked_at
The Curse of Service Object talk
Q&A question at the talk.
asked_at
The Curse of Service Object talk
Q&A question at the talk.
asked_at
The Curse of Service Object talk
Q&A question at the talk.
asked_at
The Curse of Service Object talk
Q&A question at the talk.
authored
The Curse of Service Object talk
Ivan delivered this talk at wroclove.rb 2024.
from_talk
The Curse of Service Object talk
Observation derived from the talk's tour of GitLab service objects.
from_talk
The Curse of Service Object talk
Central recommendation of the talk.
from_talk
The Curse of Service Object talk
Conclusion from measuring the example service objects against Fowler/Evans/Martin criteria.
from_talk
The Curse of Service Object talk
Drawn from Ivan's Q&A answer on OOP vs procedural.
from_talk
The Curse of Service Object talk
Q&A recommendation against the interactor gem.
talk The Curse of Service Object
presented_at
Talk was given at the 2024 edition of wroclove.rb.

Provenance

Created
2026-04-17 16:17 seed
Read by
18 extractions