0

Where do you store your old classes and files, which you don't longer use in a current project?

I have quite a few classes and files, which are no longer required, but which I would like to keep somewhere in case I need to reuse some of the code later.

Currently, I am just copying and pasting the code in a tool called Code Collector Pro.

However, since this seems not to be the most elegant way of storing old code, I would like to ask you: How do you save your old code?

AlexR
  • 5,514
  • 9
  • 75
  • 130

2 Answers2

3

If you are talking about handy snippets of code that you might use often I store them in Xcode's Code Snippet Library (just drag selected code in to create a snippet.)

Generally though, I delete unused code. If I need it again it will be in my version control system.

Michael Behan
  • 3,433
  • 2
  • 28
  • 38
  • Will the version control system (e.g. Git in Xcode) store deleted file files for later retrieval? – AlexR Jan 16 '13 at 15:14
  • You can get deleted files in git for sure, see this: http://stackoverflow.com/questions/953481/restore-a-deleted-file-in-a-git-repo – Michael Behan Jan 16 '13 at 15:16
1

I would definitely use a version control system (I'm most familiar with Subversion, but am getting into Git now). If this is code that's worth keeping around then it's code you'll likely use and modify in multiple projects over time. You'll want to be able to review the history of your changes, compare how you used it differently in project A vs. project B, and maintain notes to help refresh your memory and to help in keyword searching when you're trying to find that bit of code you remember using two years ago.

You can set up repositories however makes sense for your work - by project, by code type, etc.

I'm not familiar with Code Collector Pro - if it works as a GUI for a version control system, it may be fine for what you're doing.

David Ravetti
  • 2,030
  • 1
  • 17
  • 22