Conflict Resolution

One Definition, Not Eighteen Copies

Inspired by Episode 16: Where’s the View?

You’re reading a subscriber article on a free read. You have 1 free read left. Subscribe free for the whole archive.

Nova’s version technically works: one PHP constant, used in eighteen places across five files. The trouble arrives later. The next change to “who is on a project” has to be made in the constant, in the three places that copied it instead of using it, and in the one that changed it slightly on purpose.

Why one home matters

  • One place to change. A database view, a function or a scope: the rule lives once.
  • One place to check. Permissions and audits look at a single definition.
  • Other tools can use it. A view also works for reports, exports and admin tools. A PHP constant only works inside PHP.

Find the copies

# Every file that touches the same tables
grep -rnE 'project_members|project_roles' --include=*.php .

# Then ask the assistant
Group these matches by what each query is for. Which ones express the same
rule? Propose one definition and the change for each call site.

Assistants copy because copying always works today. Ask for one home, and the next change only needs making once.

More lessons from Episode 16

Paul’s Desk · Affiliate picks

Paul’s Desk

Gear for the fix.

As an Amazon Associate, Commits and Conflicts earns from qualifying purchases.

All of Paul’s Desk ›