Skip to content

Dissuade teams from adding side-effects in controller constructors #6569

@mcmire

Description

@mcmire

Some teams have begun adding side effects to controller constructors. The two anti-patterns we've seen recently are:

  • Calling asynchronous methods (and then ignoring the result). This makes tests harder to write, and it makes code run non-deterministically.
  • Calling controller actions. This defeats the point of the messaging system as it forces the target controller (or at least its messenger) to be present before the controller in question is initialized.

We should amend the existing controller guidelines to make teams aware of these anti-patterns, and we should inform them of the new guidelines in syncs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions