Flexible vs clean code

In reaction to a reddit post:

Maybe it’s just semantics but in programming that matters.

The goal should be to write clean code that separates logical components of the program. Clean code will be flexible. Code written to be flexible will end up being worse. Well-structured, non-repeating and easy to understand code is the best you can do.

Making assumptions about future requirements makes the code more complex than necessary and therefore worse. If you actually know the future requirements, then what you write is not flexible code – it’s just written according to the spec, version 2.0.

There may be a requirement for a plug-in architecture of some components. For example, you may want to have an easy way to add new types of enemies, weapons, special effects or even game modes. This needs to be part of the specification. Code that enables such things should still do so in the most simple way possible.