Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

While hacking on some static analysis tool, I realized I could make the task at hand (irrelevant for this question) much easier by saving the source files on-the-fly, while they were being edited.

This seemed weird at first, but being a lazy cat I actually did it, and it turns out I find this pretty useful :

  • no need to check if all files were saved before running a compiler/interpreter
  • forces you to make granular commits much more regularly

My editor has been behaving this way for a couple of days, I never had such a clean commit history, and didn't get burned yet.

In the days of DVCS when by saving we actually mean commit, do you think that manually saving files is still a relevant practice ?

share|improve this question
3  
I'm not sure what you are asking. In Visual Studio, all source files are automatically saved (but not automatically committed to the Source Control system) before a build anyway. How is your task made easier? –  Robert Harvey Sep 16 '10 at 16:45
    
@Robert: It sounds like he is describing exactly what you're talking about. –  Daenyth Sep 16 '10 at 20:38
1  
Here is the question, is there really a need to save anything on a computer? What if all programs just modified the file on disk as you wrote it (at least as far as the user is concerned.) It seems to me that our current "save" functionality derives from the assumption of much slower disk storage. –  Winston Ewert Sep 24 '10 at 3:09
    
@Winston, very true... I was very impressed when I first saw PalmOS because it has no concept of "saving" –  JoelFan Oct 22 '10 at 13:07

6 Answers 6

up vote 7 down vote accepted

I often use the opportunity to keep editing the file while the build is in progress. If they were auto-saved, the build would break while I'm editing (a broken code would be complied), and I'd just have to wait while the code is compiling. This is unproductive and boring.

share|improve this answer
    
This is the only aswer I've found to be counter-productive for what I was describing. I don't work much with compiled languages, but can definitely see how I'd turn this off on first try... –  julien Sep 21 '10 at 11:50

Delphi uses your buffers as-is when building, so "build project" doesn't require you to save your files. That's really handy for trying out a brief experiment. If the experiment works, you save your file. If not, you just undo.

Delphi 7 and earlier keep two copies of your file, the current one (Foo.pas) and a backup (Foo.~pas). More recent ones keep a longer history of your saves, allowing you to rollback to earlier versions.

Smalltalk doesn't have this concept: your source consists entirely of objects in your image, and your edits are stored in a changes file. Your file-saving's turned into per-method saving: when you hit M-s/Cmd-s after editing a method, your text's compiled and saved as a CompiledMethod object. Every now and then you need to save your image of course; that's a bit like making a snapshot of your machine rather than saving a file.

share|improve this answer

I manually save very frequently now that I use Netbeans. It has a very nice self contained history mechanism that allows me to walk back through each of my saves and even diff them independently of revision control. As for automated saving, save-on-build is as automated as I need to get for saving.

share|improve this answer

I compulsively save my source files. I can rarely get through more than three lines of code without saving a file. I like being able to save precisely when I want to, so yes, it's necessary for me.

share|improve this answer
2  
Me too. The only problem is I consistently try to save everything I edit, even in web browsers. Can get quite annoying to have the Save As file dialog wanting to save the current web page after every few lines... –  configurator Sep 19 '10 at 1:50

Yes, we really do need to be able to specify when we save our code. Every now and then my cat likes to walk on my keyboard. I really don't want my cat's edits saved. And it's real nice that I can fix it with M-x revert-buffer.

share|improve this answer
    
Visual Studio's auto save is two-part from what I understand: one part save to auto-recover location in case you go down in flames and one part save for you when you would have to save anyway like when building. This helps for the cat scenario because you need to take an action (save, build, etc) to merge the backup save with the main file, but if you have cats undo and locking the console are your friends regardless. –  Bill Sep 16 '10 at 17:46

Auto Saving has been in some IDEs for quite some time. It is a must-have feature IMHO.

I would not be in favor of auto commit to source control because I do not commit changes until I have at least done a build and seen the app spin up and where appropriate, run my automated tests.

share|improve this answer
    
Indeed auto-commit would be an heresy ! Regarding yours and Robert's mention of IDEs, I reckon this is actually a rather widespread feature, but this question is tagged text-editors :) –  julien Sep 16 '10 at 17:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.