When working on a problem often times it helps to go to someone else and talk it out. You will probably find that all you need to do it talk out the problem, the other person doesn't even have to say anything.
Hard coding that 48 pixel size for every toolbar button isn't a good idea, using a global define is much better.
Your average computer book normally don't concentrate on these types of topics/tips, because they aren't important in teaching you PHP, C++ or how to design user interfaces. But they do make you more productive by making your code more easier to read, easier to maintain, and easier to debug. This book doesn't just teach you tips for writing code, but also dealing with schedules, managers, projects, and everything project related. I do not know of another book that contains the breadth of tips like Code Complete. Here are just a few of the types of tips that are contained in the book:
- How to use parameters
- How to name boolean variables
- Different types of design
- Enumerated Types, when to use them, and how
- How to write defines (named constants) and why you should
- Use variables as short of a time as possible and why
- When to use a while loop over a for loop
- When not to use break
- Tips with boolean expressions
- Benefits of structured programming
- How to lay out and format your code (white space etc)
- Keys to effective comments
- Estimating schedules
- Debugging, more then just printf()
- Project integration strategies
- Optimization strategies
I would recommend Code Complete to any programmer. Beginner programers will of course get more out of it and older programmers will find the book contains many good reminders and perhaps some tips they knew, but had never defined.