Of all the hundreds of sites and threads I've been on relating to PID,
this one does the best job explaining a lot of common issues and how to fix them. Its written for Arduino, but the logic can be applied to any programming language. Its really well written and goes on for pages and pages.