You’re writing legacy code

We’ve all dealt with legacy code.

Too unwieldy to quickly respond to modern demands; too big to refactor whole.

No one ever considers their new lean software project to be so bad it should be thrown away.

We should rethink that.

Treat what you’re writing now as if it’s legacy code. As if its so far removed from what the needs of the project are and of such low quality that people will want to throw it away.

How will you make it easier for them to do precisely that?

Architect for it. Split up projects into small self-contained components with well-defined interfaces. Have a policy to further split these components up as they grow in scope. Make whatever code remains easily understandable. Use auto-generated documentation. Enforce coding style and size limits. Prize code clarity over cleverness or saving theoretical CPU cycles. Always leave the code cleaner than you found it. Only ever build the glue between existing products. When something comes out that duplicates what your glue does, integrate it. Code infrastructure. Aggressively adopt the latest trends seen in companies that react quickly and successfully to changing needs. Plan for adopting the wrong technology so that it’s not a set-back but an isolated learning experience.

Help future you. Make your project consist of chunks that can be quickly thrown away and replaced whole.