I just finished a fun book on the mathematical foundations of programming: Elements of Programming by Alexander Stepanov and Paul McJones.
I highly recommend this book if you're interested in a deeper understanding of programming or looking for principles to decompose software into components.
It starts with simple principles, a foundation mix of mathematics and code, and then builds on... It's short (230 pages) but will take a while to read as it's full of exercises, which you really need to do if you want to get the most out of it.
It's not an easy read, but Elements of Programming could change the way you think about programming...
The code from the book and an interview of the authors are available online.