Wednesday, December 7, 2011

Technique


I have learned a few things in my time programming that might save you some time. The ideas shouldn’t be new, but you might not have taken them all that seriously. The first tip is probably something that anyone working with computer has heard at least one: backup your work. The second tip: finish your work in the correct place.

Backup your work

This is more than having another copy of your code saved somewhere safe; yet still, it is a good idea to save your code in multiple places in well labeled directories so that you can find what you need, when you need it. Backup while programming is much more involved. Since your work is always changing and can contain thousands of lines of code, it is near impossible to revert back to where you started if you mess something up. Since a program is modular, you can easily finish a module and make sure it works before starting on another section. This is a great time to save your work, and make a copy. Anytime you want to veer off and try something that you are not sure will work, save your work and make a copy. My reasoning is that you will be able to go back to a point where you know the code worked. Trying to go back and revert changes can end up creating more mistakes in the long run that you have to debug and fix. If Visual Studio, or whatever IDE you are using, crashes and corrupts the file you are working on, you can go back to one that you know works.
If you are like me, you heard about backup and didn’t think it was too important. I figured I would be okay too, until one day Visual Studio corrupted everything. I could not recover any of my work and had to start over from scratch. There were other times when I made drastic changes trying to debug a problem and ended up making things worse. I hate the feeling when my head feels heavy and my blood is boiling because I can’t fix something that worked before I decided to experiment with a different idea. I was so close to being done for the night, but gave myself extra work that had to be finished… because of my second tip.

Finish your work in the correct place.

This might seem a bit abstract, but it really is an important point. Think about when you write a letter or a paper: would you take a break in the middle of a sentence? Probably not, because you want to complete the thought before it is lost. It is the same with programming. Making comments for yourself about what you are thinking and what your ideas are for continuing really help you get back on track with where you left off. Alternatively, you can send yourself emails of your ideas, if that suits you. The important thing is to remember your thought process and the ideas that you have tried and considered trying. It really is best to finish the day when the part you are working on is complete and working. This will allow you to start fresh the next time you sit down and able to pursue different parts of the program without having to get back in the mindset of a previous day.
This idea of where to stop for the day is abstract since everyone is different. You may be able to pick-up right where you left off with no issues, you may not. Just remember, if there is a serious flaw in your code and you have been trying to fix it for hours, keeping notes of where you have been and where you are headed can greatly improve your productivity. Try different methods like commenting the code and emailing yourself to see what works best. I find emailing myself can help keep the issue in the front of my mind so that I might be able to come up with a solution even while I am not sitting at the computer coding. 

No comments:

Post a Comment