Are there any techniques to separate code and markup in WordPress?
Agreed with Denis, Wordpress simply is spaghetti, and there's nothing you can do about that. Nonetheless, if you're writing your own code for Wordpress (we make themes and plugins for our customers), there's nothing stopping you from splitting the concerns out into different files, and we found that it's much easier to maintain that way. You'll still have to coop with situations where Wordpress expects vanilla PHP files, but at least our code looks decent ;)
I generally work with Python to create web apps and love how I can work separately with the code and presentation layers. I really like working with Jinja2. But, I sometimes have to work with WordPress for my clients. So, I wonder, if there are any ways to make developing for WordPress a less headache with all its header.php, index.php and footer.php as well as all other pieces that may join together well or may not. Are there any suggestions to make it more convenient?