KahWee

Thoughts on web development, programming, and technology

When Rebuilding is Better than Refactoring

Recently we needed to rebuild several pages after introducing a new entity to our data model. Instead of updating each existing implementation, we rebuilt everything from scratch. The rebuild was not only faster, but let us use modern patterns that would have been difficult to retrofit.

Scaffolding vs Refactoring

The math on rebuilding has shifted. UI development today costs much less than five years ago - better tooling, mature component libraries, and improved CSS make starting fresh viable more often.

Much of our codebase predates TypeScript, with some components still using Flow annotations. When facing significant changes, we're finding it's often faster to scaffold new components using current patterns than trying to incrementally modernize legacy code.

Legacy code carries hidden costs: outdated dependencies, deprecated patterns, assumptions that no longer hold. Starting fresh means applying lessons learned and using current best practices without fighting existing architecture.

Current Tooling

Cursor has replaced VS Code as my default IDE. The AI integration feels more natural - contextually aware tab completion and suggestions that flow with development rather than interrupting it.

I tried Warp.dev but found the interface clunky compared to traditional notebook environments. The promise is there, but the execution isn't ready yet.

React's ecosystem has matured significantly. Libraries like TanStack Query solve problems we used to handle with complex custom implementations. The tooling improvements make rebuilding a more attractive option than it used to be.

When to Rebuild

This approach works best for UI components and feature-specific code. Critical systems and complex business logic still need careful refactoring. But for user interfaces, the threshold has shifted toward rebuilding.

The tools enabling faster development - AI assistance, improved frameworks, streamlined deployment - also compress time for documentation and reflection. The challenge is capturing insights during development rather than afterward.

All Tags