algorythm - to me good code comes from common sense, and from being able to see simple solutions to complex problems. You've never struck me as being short of common sense so that's a good start
It may well be worth paying your local library a visit to see what they have on the subject of software engineering. It's important to consider the whole process, not just the act of writing code. If you can get the overall process right, the coding bit becomes easier - you know right from the start what it is you're trying to achieve (in significant detail) thereby allowing to to make well informed decisions regarding what bit of code wants to sit where and how flexible it needs to be (over engineering can be as bad as under engineering)
From personal experience, and seeing how some of my less experienced colleagues suffer, I still think the best way to code is to write a bit, test it, write a bit more, test it. Debugging becomes a lot easier when you know you're only concentrating on a few blocks of code at a time. The result (again, in my experience) is code that is more robust and easier to navigate.
It doesn't matter if you build your code top-down (framework, then detail) or bottom-up (modules then framework) as long as you have the end goal in sight. You don't want to end up with the 'christmas tree' effect where you've got loads of
cr@p all plugged in together with no sense of cohesion
Hope this is of some help and isn't too patronising