It was supposed to be a demo. We built it in a week to show a potential customer what the product could look like: hardcoded values, no error handling, and a database schema that would make anyone wince. It was the kind of code you write when you know it's going to be thrown away.
The customer loved it, signed, and wanted it live by the end of the month. We said we'd rebuild it properly. We didn't.
Instead, we fixed the most embarrassing parts and shipped it. Then we fixed a few more things, then a few more, and the prototype became the product one patch at a time.
This felt wrong. We kept apologising for the code and promising a rewrite that never came, and every time something broke, someone would say, "Well, it was only supposed to be a prototype."
It worked, though. It wasn't elegant and it wouldn't have impressed anyone reviewing the architecture, but it solved the customer's problem. They paid us, renewed, and referred other customers.
The "proper" version we'd imagined would have taken months. It would have been cleaner, more extensible and better tested, and it would also have been late. By the time it shipped, we might have learned that half our assumptions were wrong.
The prototype taught us what mattered: the parts that broke needed attention, and the parts that didn't break were, apparently, fine.
I used to think there was a clear line between prototype and production. Prototypes were experiments, production was serious, and you didn't ship prototypes. Now I think the line is blurrier than we admit. A prototype that solves a real problem is already production, whether you call it that or not, and a "production" system that nobody uses is just a prototype that got too much funding.
Code only has to be good enough for what it needs to do right now. "Right now" is the only time that matters, because by the time you've built the perfect version, the requirements have changed.
We did eventually rewrite parts of that system, though not all at once and not because we'd planned to. We rewrote the parts that hurt, when they hurt, and left the rest alone. Some of the original prototype code is still running years later, and nobody complains.