I use principles like KISS and DRY as questions, not rules to apply everywhere. Is this easier to understand? Are these two pieces of code actually the same responsibility?

The answer depends on the change in front of you. A principle helps when it makes that decision clearer for the team and for whoever reads the code next.

Keep the solution understandable

KISS is a reminder to make the path through a problem easy to follow. For a form with two validation rules, two clear checks may be enough. A configurable validation engine needs a stronger reason than the possibility of more rules someday.

Simple does not always mean short. An explicit branch with a useful name can be easier to maintain than a dense expression. Handle the required failure cases even when they add a few lines.

Share knowledge that changes together

DRY is most helpful when repeated code represents the same rule. If several screens decide whether an order can be cancelled, that decision deserves a shared home. A policy change should not require hunting through unrelated components.

Two pieces of code that look similar may have different reasons to change. A customer address and a warehouse address can start with the same fields while carrying different requirements. Wait for a real shared responsibility before forcing them into one abstraction.

Give each part a clear responsibility

A screen can coordinate a flow without also knowing how a database stores every field. Separate the parts that change for different reasons: presentation, business decisions, and communication with external services.

The goal is a boundary someone can explain. Adding a new layer that simply passes the same arguments through may increase the reading required without protecting anything useful.

Check the result against a real change

Try a concrete requirement: a cancelled order must keep its history. Which files need to change? Can the rule be checked without opening every screen? Does the interface communicate the new behavior clearly?

Use that evidence to judge the design. A principle has earned its place when it helps the team make this kind of change with less uncertainty.

A small example: cancelling an order

Imagine two screens showing a Cancel button. Both need the same rule: a paid or shipped order cannot be cancelled. Keeping that rule inside each button makes it easy for the screens to disagree later.

A named function gives the rule one place to live. The interface can use it to decide whether to offer the action, while the server must enforce the same policy before changing data. Hiding a button alone is not authorization.

If the requirement changes, update the rule and check cases such as a pending order, a paid order, and an order whose status changed after the page loaded. That is a useful abstraction because it represents one business decision, not because it saves a few lines.

function canCancelOrder(order) {
  return order.status === "pending";
}

// Use for interface feedback; enforce the rule on the server too.
const showCancelAction = canCancelOrder(order);