This page was translated from the original by AI.

Do not seek haste, do not chase small gains; haste makes waste, and chasing small gains ruins great things.

— The Analects

Lately I've been refactoring a project that I migrated from Phoenix to Rails.

Since it's a personal project I use myself, I often don't plan ahead when adding features—I just "write it and see," then optimize as problems come up.

But the side effects of this approach are obvious:

New code often ends up making the existing structure messy and hard to maintain.

That's when you get stuck in a dilemma—

Do you make do with what you have, or invest time in a thorough refactor?

Leaving things as they are feels unsettling,

while refactoring means sinking in even more time.

So I started to reflect—

Actually, instead of writing and revising as you go, it's better to spend a little time thinking things through before you start:

What am I trying to achieve? Where are the boundaries? What is this part's responsibility?

When the groundwork is done, the code tends to come naturally.

"Think before you write" may seem slower, but it's actually faster.

Just like that classic line from JoJo's Bizarre Adventure: Steel Ball Run—

Johnny, this is Lesson 5. The detour is the shortest shortcut.
Epona
Written byEpona

There's nothing wrong with having a little fun

x.com/simura_epona

Loading comments…