Book: Clean Code by Robert C. Martin
The examples are "very Java" at times, and you might not agree with all the choices the author makes, but don't be discouraged: the book gives you some very useful principles about how to structure your code, split it into simple parts, and generally avoid making a mess (I think the most valuable one was operate on a single level of abstraction at a time). The book includes real-life examples that are really helpful for understanding.
Overall, I think my time reading this book was well spent.
Some important points:
- "The folks who think that code will one day disappear are like mathematicians who hope one day to discover a mathematics that does not have to be formal."
- (Michael Feathers) Clean code looks like written by someone who cares; there is nothing obvious you can do to make it better.
- Tests have different requirements than production code but have to be kept clean as well, or it will impact your project seriously.
- You should be able to describe what your class does in a simple sentence that doesn't contain any "and"s or "if's.
- Refactoring "is like solving a Rubik's cube" - you have to make a lot of small steps, not always straight to the goal.