Один случай, где дополнительные методы были довольно полезны, был в клиентском приложении, которое использует веб-сервисы ASMX. Из-за сериализации, типы возврата веб-методов не содержат методов (только общественные собственности этих типов доступны на клиенте).
Дополнительные методы позволили использованию добавлять функциональность (на клиентском) к типам, возвращенным веб-методами, не имея необходимость создавать еще одну объектную модель или многочисленные классы обертки на клиентском.
Have you ever:
In these cases, and no doubt others, a version control system should make your life easier.
To misquote a friend: A civilised tool for a civilised age.
Это зависит от размера проекта и от того, как часто вы меняете свое мнение о его частях. Для небольших проектов, где вы просто выполняете что-то линейно, контроль версий, вероятно, не принесет большой пользы (хотя, если вы случайно удалите или повредите файл без контроля версий, вы будете плакать).
Но пару недель назад я встретил друга, который сам писал огромный хобби-проект. У него было десять или двадцать копий своего кода с такими суффиксами, как «X1», «X2», «test», «быстрее» и т. Д.
Если вы сделали более двух копий своего кода, вам нужен контроль версий . Хорошая система контроля версий позволяет вам отменить изменение, которое вы внесли некоторое время назад, не отменяя того, что вы сделали после внесения этого изменения. Это позволяет увидеть, когда были внесены определенные изменения. Он позволяет вам разделить ваш код на два «пути» (например, один для тестирования новой идеи, другой для обеспечения безопасности вашего «проверенного и надежного» кода до тех пор, пока вы не закончите тестирование), а затем снова объединить их вместе.
You'll probably want something like subversion even if you're working by yourself so that you have a history of all your changes. You might want to see what a piece of code looked like once upon a time to remember why you made a change.
Having source control is also useful when you check in often. If you check in often, you'll always be in a state to roll back often too. Many times you could start going down one path to solve a problem and then realise it was the wrong path to go. Many times you could just keep barking down the wrong path and end up building a terrible solution - only because you didn't want to lose all your work. By checking in often, the last point of "happiness" is not far away so even if you go down the wrong path you can always roll back and try again and make a more elegant and simple solution. Which is always a good thing so you can understand and maintain what you wrote in the future.
Я также только недавно начал интересоваться контролем версий. В системах контроля версий у вас есть концепция репозитория для вашего кода. Множество новых команд оболочки изучается очень быстро, так что вы можете взаимодействовать с этим репозиторием.
После сохранения кода в файл вы можете зафиксировать его в репозитории вашего проекта. По мере того, как вы разрабатываете свой код и фиксируете свои изменения, репозиторий разрабатывает серию ревизий . Вы можете получить доступ к любому из них, проверив версию. Если вы работаете один, маловероятно, что вы Я буду много проверять, если вы не потеряете файлы кода или не захотите работать на другой машине. В этих случаях вы обычно проверяете последнюю ревизию всех файлов.
Лично я больше не сохраняю файлы или папки с именем 'project_old', когда я решаю что-то реорганизовать. Любые внесенные мной изменения сохраняются постепенно, и я всегда могу вернуться к проекту, который работал в целом. Я редко использую FTP для развертывания сейчас, потому что я просто проверяю свой код через ssh. Загружаются только те файлы, которые я изменил, и если мне нужно перезагрузить сервер, терминал уже там.
Я нашел этот доклад на GIT действительно поучительным; http://www.youtube.com/watch?v=4XpnKHJAok8
Это разговор в Google, в котором Линус Торвальдс приводит аргумент в пользу использования одной системы контроля версий над другой.
Sounds like you're looking for something a bit more light-weight. Check out Mercurial (awesome reference book). I use it for everything, from source code to personal correspondence.
Some benefits:
Even if you haven't been in a situation yet where you needed an older version of your program, having a source control gives you greater confidence to make major changes.
I found myself doing more aggressive refactoring after using source control because I always knew that a working version could be easily restored.
You may find that you had a working version of your program.
You decide to add a few new features over a period of time and you release that.
You start getting bug reports affecting some code that you thought you didn't touch.
By using SVN, for example, you can move back to an older version, and check to see if the new bug exists. Once you find a version that introduced the bug it will be easier to fix it as you can compare the version that worked to what didn't work and see what changed, then it will narrow down the search.
Source control has many uses, even if you are the only developer.
It is also about backing up old file that why it is called "Subversion". So you can manage multiple version of your work in which you can return back (revert) and manage the different implementation of it (branching).
Что-то, о чем, кажется, никто не упомянул явно, - это маркировка выпусков. Если у вас есть клиент, использующий версию 1 вашего программного обеспечения, и вы заняты работой над версией 2, что вы будете делать, когда клиент сообщает об ошибке и вам нужно собрать версию 1.1?
Система управления версиями позволит вам пометить каждый выпуск, который вы делаете, чтобы вы могли вернуться к нему позже, внести исправление (и объединить это исправление с кодом новой версии 2) и сделать новый выпуск, не беспокоясь о том, что вы можете случайно доставить что-то, что не готово.
Источник контроль - это основная часть современной разработки программного обеспечения. Если вы не используете его (даже для личных проектов, поскольку чем больше у вас опыта, тем лучше), вы делаете что-то не так.
Обычно один из первых вопросов, который я задаю при приеме на работу, - это «Что вы используете для контроля версий?» Пока только в одном месте написано «Ничего», но они планировали исправить это «Скоро сейчас ...»
The fact that other developers participate or not is totally orthogonal to the need of a version control system.
You can be the only developer but still will benefit from:
Now, if you have a group developing on the same codebase version control is still more necessary so
When there is more people involved it is more relevant which version control tool you pick, depending on the style of development.
Version control is great for checking previous versions, even if you're working alone. For example, if you accidentally delete code or a file you can get it back; or you can compare previous versions to see why a new bug has crept in. It's also good if you're one person working in multiple locations.
My personal favourite is git.
Even as a single developer source control offers a great benefit. It allows you to store your code's history and revert back to previous versions of your software at any time. This allows you fearless flexibility to experiment because you can always restore to another version of your source code that was working.
It's like having a giant "undo" button all the way back to your first line of code.
You gain security (in the sense of having a back-up of your code) and versioning of your code (assuming you get into a habit of committing your changes often). Both are very good things even if nobody else ends up ever working on the code with you...
Version control is a rare tool that I would say is absolutely required, even if you are only using it as a solo developer. Some people say that it's a tool that you live and die by, I agree with that assertion.
You probably use version control right now, even if you don't know it. Do you have any folders that say "XXX Php Code (December)" or "XXX.php.bak.2"? These are forms of version control already. A good version control system will take care of this for you automatically. You will be able to roll back to any point in time (that you have data checked in) and be able to see an exact copy of that data.
Furthermore, if you adopt a system like subversion, and use a remote repository (such as one on a server you own), you will have a place to keep all of your code. Need a copy of your code somewhere else? No problem, just check it out. Hard drive crash at home? Not an issue (at least with your source code).
Even if you don't use version control now, you will likely use it at one point in time later in your career and you could benefit from becoming more comfortable with the principles now.
Происходило ли такое когда-либо при работе в одиночку? Вы запускаете приложение, и что-то не работает, и вы говорите: «Это сработало вчера, и я клянусь, что не касался этого класса / метода». Если вы регулярно проверяете код, быстрое сравнение версий покажет, что именно изменилось за последний день.
Version control is almost impossible to live without after you start using it. It is indispensible if more than one developers are working on the same code base...but it also quite useful for a single developer.
It tracks the changes in your code and allows you to roll back to previous versions. It frees you to experiment with the knowledge that if anything breaks you can undo your changes.
Even if you work alone you can benefit from source control. Among others, for these reasons:
You don't lose anything. I never again commented out code. I simply delete it. It doesn't clutter my screen, and it isn't lost. I can recover it by checking out an old commit.
You can experiment at will. If it doesn't solve the problem, revert it.
You can look at previous versions of the code to find out when and where bugs were introduced. git bisect
is great in that regard.
More "advanced" features like branching and merging let you have multiple parallel lines of development. You can work in two simultaneous features without interference and switch back and forth without much hassle.
You can see "what changed". This may sound basic, but that's something I find myself checking a lot. I very often begin my one-man workflow with: what did I do yesterday?
Just go ahead and try it. Start slowly with basic features and learn others as you go. You will soon find that you won't ever want to go back to "the dark ages" of no VCS.
If you want a local VCS you can setup your own subversion server (what I did in the past), but today I would recommend using git
. Much simpler. Simply cd
to your code directory and run:
git init
Welcome to the club.
There are a number of reasons to use version control, even if you are the only person who will ever touch the code.
If you keep your code under version control, then it makes it really easy to see which files you have changed (or have forgotten to add to the baseline).