views:

886

answers:

36

When writing code, I've noticed that different developers hit the Save button at different frequencies. This is in addition to whatever AutoSave setting has been set. Personally I have the AutoSave set to 10 minutes, and I hit the Save button whenever I type a reasonable amount of code (perhaps 10 to 30 lines). How about you guys?

+17  A: 

I save when I complete my thought, or right before I want to run my code.

J.J.
agree.. after run my code :)
unkiwii
A: 

I agree with J.J. and hit it when I'm done with my thought. I have tried my fingers to save frequently because I use a lot of editing programs that don't support auto-saves. I lost about half an hour's worth of code once due to a power outage...once bitten twice shy.

j0rd4n
+2  A: 

I (necessarily) save just before I hit the compile button, which is very often. Every few minutes perhaps?

I remember years ago the Borland IDEs had a feature where they would compile from memory, because saving the file to disk before compiling was seen as "too expensive". I recall losing much work because the IDE crashed after not having saved my code for hours.

Greg Hewgill
Save before compile is an habit which saved me from redoing a lot of work when unreliable compilers/IDE decided it was time to quit abruptedly...
Manrico Corazzi
Which reminds me of this random complaint: Apple Xcode is ridiculously unreliable, whether you're talking about the latest stable version (3.1) or the latest beta (3.2).
Elliot
+41  A: 

I save every time I stop typing and start thinking.

directrixx
Same here; whether I blast out a short to medium burst of several lines, or just one long line, I tend to err on the side of saving at convenient pauses, which I learned through bitter experience.
Rob
Ctrl+S is probably my most used key combo.
conmulligan
Its starting to become a nervous twitch of mine. A good one at that.
Ólafur Waage
I even save before typing in again!
jop
I even automatically hit ctrl S when entering this comment
Martin Beckett
A quick keyboard save has also become one of those subconscious actions whenever there's a break in the mental action. Though instead of Ctrl+S, I use Alt,F,S as it's more consistent for the apps I use.
AR
Why is it a "good" "nervous twitch"? Considering how often it's done and how brief an amount of time it takes, why don't our editors do this for us automatically? e.g. AutoSave whenever there are 5 seconds of no typing.
Elliot
A: 

I have slight OCD for hitting Save. If we're measuring in thoughts, I would say I do it after every one.

tags2k
A: 

No auto save here, that would only save when the code is not executable, not a clever idea. My editor creates real-time backups of the buffer so if it crashes I can recover easily. How often do I save? Not so sure, when refactoring after each refactoring step to check if it still runs [in dynamic languages] and normally every run or ~20 minutes, whatever comes first.

Armin Ronacher
A: 

Every 1.3 minutes or less (if i stop writing and start to think i save)

unkiwii
+1  A: 

Sometimes as often as every line, but usually after a "semantic unit" of code. I frequently forget to save when dong Edit and Continue in Visual Studio, though :-(

Bob King
A: 

I only autosave. I hate working in IDEs that don't save for me.

I compile every five minutes or so. It may break, but that's ok; I'm saving. If I'm doing a large architectural change that spans more than a few files, again, I'll compile every so often just to get the save down (and also to make sure I'm not making stupid errors).

mmr
A: 

I'll save whenever I finish typing something, though I maintain a mostly consistently applied rule of only saving when what I've got should compile.

Of course, using vim, the ":w" combination is pretty much hard-wired into my brain now.

Jason Etheridge
+6  A: 

I save almost immediately after changing something.

I test after a few (5 - 10) saves

I commit after finishing any significant change that passes the tests

My CI server builds and tests 5 minutes after my commit.

Pablo Fernandez
+5  A: 

Ctrl+S and Ctrl+Shift+S is the most used combination on my keyboard...

lluismontero
Ditto, although Ctrl+C and Ctrl+V come pretty close...
conmulligan
A: 

I save pretty frequently - certainly after writing any complex lines of code. Been bitten too many times by Visual Studio crashing at inopportune times.

But more than that, I also shelve pretty frequently so my code isn't only saved locally, it's saved on our source control server, at intervals before I am ready to check in. (For those not using TFS, shelving is similar to a private branch).

Greg Beech
A: 

I really don't know. I'm doing it unconsciously.

radu_c
+4  A: 

All the time. It's instinctive.

cntl-s in windows.

or

:w in vim*

or

: map v :w^M:!gmake my_prog 2>&1 \| tee results^M:!my_prog 2>&1 \| tee my_output^M

and then I'm hitting v all the time, when developing using vim*

just embedded paranoia from when I started in 1975, when things would "go south" for no reason! (-:

Rob Wells
A: 

Right after my code works, and before I move onto the next thing :)

Kolten
A: 

If you have either an editor that supports undo across saves, or an extension to your editor that makes each save create a local revision (sort of like local source control) then you can save with reckless abandon.

Luke
A: 

I'm the same as some other posters - saving when I stop thinking. This has the added benefit of not saving screwed-up code, if I realise I've messed it up before I stop thinking that is :) For this reason, I don't like auto-save.

flashparry
A: 

I never press save, I compile, which forces a safe.

Slace
A: 

I constantly hit Ctrl+S out of habbit. It's like I can't stand to see the little asterisk by the filename. It agitates me just looking at it!

Zach
A: 

I never hit the save button, but always hit CTRL + S instinctively after I make some change. So I end up saving frequently enough to not lose more than 1-2 lines of work at any given time due to any incident.

Imran
A: 

I never press save - I use Intellij IDEA and it saves files on frame deactivation. In case I corrupt something it maintains local history which works similar to version control system.

Pavel Feldman
And you can set it to save any time the editor is idle.
Darron
A: 

(Ok...beating the dead horse a bit...sorry.)

A good rule I learned from gaming:

SOS = Save Often Stupid

Your soul or sanity may just need to be saved after grinding 10 levels and losing them all to a boss. ;)

Also learned to keep multiple saves for when you find out something you did was really stupid. ;)

Jonathan Lonowski
A: 

I save frequently. Whenever I complete a small little bit of code I save. If I modify something just slightly I'll save. I've been a victim of power surges and lightening strikes at the most inconvenient times. That is the downside to sunny-florida.

Zee JollyRoger
A: 

Another CTRL+S addict confesses his sins :)

chocolate_jesus
A: 

I routinely go hours without saving, sometimes several. Lost power once while I was gone at lunch. I went a couple hours without saving. Came back, thought I was screwed. Booted up, Visual Studio actually brought me right back where I left off (recovered).

In fact, I never actually click the save button (or Ctrl+S). I just do a rebuild which essentially saves it.

Josh Stodola
A: 

Hitting CTRL+S has become a habit now... I do it without knowing. As others have said already, I save when I pause coding and start thinking again. For that matter, I save a lot more often when I'm having trouble focusing on the project that I'm working on. =)

Brian Kim
A: 

I used Brief for OS/2 for quite a while - a bad version of a good editor. It crashed at unpredictable times. Ever since then I've been hitting Ctrl-S every minute or two.

Andrew Queisser
A: 

I save very infrequently. In fact, I rarely explicitly save my work. It already gets saved when I do a build, which I feel is often enough. Then again, I can't remember the last time my IDE crashed, let alone my computer. Are people's systems really that unstable that they find a need to save every 2-3 minutes? If you save so frequently, don't you increase the likelihood that the file will be in the middle of saving, exactly when it crashes, causing potentially more problems then if you hadn't saved?

Kibbee
A: 

I save during a coding pause, before compiling, running unit tests. Short answer very frequently. I use our version contorl system as a 'global undo' if I need to revert changes.

Keith Moore
A: 

I use the TextMate setting to save after losing focus on the pane. I am looking forward to Google Docs style IDEs that have a total history of everything you typed...

MattMcKnight
+1  A: 
  1. Save after typing in a "chunk" of code,
  2. (Re-)compile after a the functionality is added (or the bug fixed),
  3. Run my unit-test after the code compiles,
  4. Check it into version control after unit-test (and any regressions) pass.

It's nice if you editor has macros for each of the above steps...

+9  A: 
Marcel Tjandraatmadja
A: 

I hit save as i do the addition or changes in code so that if something happens i don't have to do all over again.

jazzrai
A: 

Save soon, save often. Command-S

Mark Stock
A: 

We use a proprietary IDE, which is not surprising as it is a proprietary language. We have linked the save to the syntax check button, so every time I check syntax, I also save. We have the check syntax as the language is compile on loading (we only save source code) and an application will fail to load if there is a syntax error.

Jim C