Search⌘ K
AI Features

Problems With Presenters

Explore the common issues presenters introduce in Rails views, such as inconsistent data exposure and confusing object types. Understand why relying on helpers can make views easier to manage and learn conventions for safely using presenters to maintain clarity and sustainability in your web apps.

We'll cover the following...

Presenters breed inconsistency, which leads to three specific problems:

  • Adding a presenter pattern creates two ways to expose data to a view: a well-defined domain model, or a presenter that wraps one. This invariably leads to more inconsistencies because many developers, upon seeing two ways to do something, will introduce a third. The team has to be proactive about preventing a proliferation of presenter patterns from popping up.

  • When reading view code, it’s not easy to tell what sort of object we actually have. Is our @widget a Widget or a WidgetPresenter? Has our @widget instance been given new methods that only exist in a view? Is it missing methods a normal widget would have? These questions can be very hard to answer.

  • When creating or editing a new view, developers have to decide if they should make a presenter or not. Some will feel they always should (even if they don’t need it) because they might need it. Others won’t.

This is a hard ...