When to use x-objects?
So I wrote a few short articles on when to use FormObjects and Jobs and ServiceObjects. The question is of course “it depends”, but the leading principle I have is keep it simple. That being said, for inspiration, some suggestion for different layers to manage the application complexity from Vladimir Dementyev’s talk on Railsconf:
Presentation
- Controllers (standard Rails)
- Channels (standard Rails)
- Views (standard Rails)
- Presenters
- Form Objects
- Filter Objects
Application
- Authorization Policies
- Jobs (standard Rails)
- Event listeners
- Interactors
- Deliveries
- Notifiers
- Mailers (standard Rails)
- (Service objects) (he considers these as a bucket of objects waiting for the right abstraction)
Domain
- Query objects
- Models (standard Rails)
- Configuration objects (somewhat standard Rails)
- Value objects
- Decorators
Infrastructure
- API Clients
- Adapters (DB, Mail)