Also, if you have not yet learnt about automated testing, then do. One writes code to exercise different parts of the application code to check it does the right thing - unit testing is an example of this. If done well, this kind of testing can give you safety when changing code as, since they're executable, you can execute them frequently and failures tell you that something is broken.
I first learnt about automated testing in the context of test-driven development. It's a process in which you write these sorts of tests _before_ writing the application code. There's a lot of literature on the subject, but at the least working this way helps you focus on the "what" you want the software to do, rather than the "how" and helps produce code that is easy to test in this automated fashion (as writing tests after the code has been written can be quite difficult for various reasons).
I first learnt about automated testing in the context of test-driven development. It's a process in which you write these sorts of tests _before_ writing the application code. There's a lot of literature on the subject, but at the least working this way helps you focus on the "what" you want the software to do, rather than the "how" and helps produce code that is easy to test in this automated fashion (as writing tests after the code has been written can be quite difficult for various reasons).