The common advice in frontend development is to create reusable components by abstracting similar screens. However, this article posits that sometimes it is better to delay this process. Creating an abstracted component incurs higher coding and coordination costs, and a wrong abstraction can be more expensive to undo than simply removing duplicated code.
The author recounts an experience with three distinct workflows: item approval, item change, and item movement. Despite their interfaces appearing similar (item list, select, confirm, results), the underlying processes had critical differences. These included how they handled partial failures, specific requirements, and auditing needs. For instance, item relocation involved another system that could reject requests, a factor not present in the other workflows.
Initially, the decision was made to create a single component due to the perceived similarities. This led to a component that grew in complexity, incorporating numerous flags and modes (e.g., 'mode', 'variant', 'showDetails', 'requireReason', 'onSpecialCase') to accommodate the distinct behaviors of each workflow. This approach resulted in a component with multiple submission paths and error shapes, indicating that the initial abstraction was flawed because it did not account for the deeper functional divergences.
✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →
One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.
One email a day. Unsubscribe in one click, any time.
Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.
▶ Play today's briefNew every morning, and the back catalogue is archived by date.
This article argues against immediate creation of reusable components, suggesting that premature abstraction can lead to higher costs and complexity than initial code duplication. It highlights a case where surface-level similarities between three workflows led to a single, overly complex component that failed to account for distinct underlying requirements and failure modes.