One of things that come with experience is the ability to foresee the potential changes and ensure that, when possible (preferably during the initial spec phase) the solution is extensible/flexible enough to accommodate the most likely changes.
For a simple example, if you're asked to implement something like a blog, you would naturally be prepared to be asked for authentication, authorization, contact us forms, commenting, etc. If you're aware that there's a high probability of such a change request in the early phases (but not NOW), then that anticipation will usually result in better code.