shlogg · Early preview
Sinaptia @sinaptia_dev

Form Object Pitfalls: Simplifying Complexity In Rails Applications

Break down form object complexity by separating responsibilities into smaller objects: service objects, validation objects, view models/presenters & delegates persistence to model classes.

Note: The current article is based on Ruby on Rails examples, but the core idea should apply to other languages and frameworks.
The first
Let’s start trying to define some concepts:
What’s a form object?
What’s their architectural purpose?
According to the articles linked at the bottom and our own experience working on several Rails codebases using form objects, there’s a variety of definitions and objectives. To enumerate a few:
What are they? what do they do?
A plain old ruby object that runs validations on data input
Virtual models that represent the aggregation of other model objects
Repla...