Even though I have been writing programs for most of my life, that does not mean that my programs have always been written well. Only following the standard prohibitions on spaghetti code and documenting well does not a good program make.
The best advice I ever got about writing programs was to read two books:
1. The Pragmatic Programmer, by Andy Hunt and Dave Thomas
2. Code Complete, 2nd Edition, by Steve McConnell
After applying the techniques from these books, your programs will be much easier to maintain, and much more efficient.
A third book that is also quite helpful is Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides (aka the Gang of Four).
These books are all available at Amazon.com in paper or Kindle format.