It's been a fun last couple of days. First, I ran in the Gobble Jog 10k on Thanksgiving morning. The weather for the run was nice and cool, and I managed to meet my goal of under an hour with a time of 58 minutes. Being that it was my first 10k I was pleased with how I did.
After that I was headed out of town for Thanksgiving with my fiance's family. There was a lot of great food and even better people. Then it was back to Atlanta for Thanksgiving with my family. All in all a great couple of days filled with awesome food, and excellent company.
So I finally had a little bit of time to get some work in, but not quite enough to get OAuth working in my Twitter app that I made for chapter 2 of Head First iPhone Development. However, before I attempt to get my project to work, I want to be able to undo anything and revert back to the project's original state if I mess everything up. I could make a copy of the project as a backup, but there's a better and more sophisticated method.
Source control. It's a repository of your code that essentially is a snapshot of your project the last time that you committed it. That way as long as I commit my project before I attempt to implement OAuth I will be able to revert back to the original state of the project with the push of a button.
There are many different source control systems you can work with. I opted to go with Subversion because it has nice integration right in to Xcode. I am using a local repository on my laptop because I am only saving learning projects at this point. Once I am working on more important projects I will likely use an external repository incase anything happens to my laptop.
Once you create a Subversion repository you can add it to Xcode very easily. From that point you can import your project, and then check it out to start working on a controlled version of it. Once you save some changes to a file you will see an 'M' next to it in the project window indicating that it has been modified. You can commit the file to save the changes to Subversion, or you can revert the changes to get the file back to it's original state.
The best use of a source control system is to do checkins daily, and even more often if you just implemented a large piece of logic. It is good practice to only check in code that compiles. That way no matter what you do to the code you can always rollback to a stable version that builds. Now that I have Subversion in place I will begin trying to implement OAuth so that my InstaTwit application can send the tweets to Twitter.
i am also using it successfully. good job man as its quite informative and helpful for beginners..
ReplyDelete'It is good practice to only check in code that compiles' - Fully agree particularly in teams. Even then we used to get issues with the main built but at least this way it's only once every few weeks rather than daily!
ReplyDelete