~/adventure-log/2025/10/think-before-code
LifeThis page was translated from the original by AI.

Haste Makes Waste

While refactoring a project that I migrated from Phoenix to Rails, I realized that a lot of messy code isn't poorly written—it's poorly thought out. Instead of writing and revising as you go, it's better to think one step ahead before you start. As that famous line from JoJo goes: the detour is the shortest shortcut.

Published
Reading time
2 min
Tags
EssaysRails

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.

You got a collectible· Item get

No.014

Dewdrop Cap

Common

Region
Wanderer's Woods
Found near
Essays · Rails
Discovered
Journey
2 min

Earned by finishing this quest. The more travellers who read it, the rarer it grows.

Epona
Written byEpona

There's nothing wrong with having a little fun

x.com/simura_epona

RelatedNearby quests

Loading comments…