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.

Today I develop on a fairly complex computer, it has multiple cores, SSD drives and what not. Still, most of the time I'm programming the computer is leasurely doing nothing. When I need to compile and run/deploy a somewhat complex project at best it still takes a couple of seconds. Why? Now that we're living more and more in the "age of instant" why can't I press F5 in Visual studio and launch/deploy my application instantly?

A couple of seconds might not sound so bad but it's still cognitive friction and time that adds up, and frankly it makes programming less fun. So how could compilation be instant?

Well, People tend to edit files in different assemblies, what if Visual Studio/The IDE constantly did compilation/and building of everything that I modified anytime that it might be appropriate. Heck if they wanted to go really advanced they could do per-class compilation. The compilation might not work but then it could just silently do nothing (except adding error messages to the error window).

Surely todays computer could dedicate a core or two to this task, and if someone found it annoying it could be disabled by option. I know there's probably a thousand technical issues and some fancy shadow copying that would need to be resolved for this to be seamless and practical but it sure would make programming more seamless.

Is there any practical reason why this scenario isn't possible? Would the wear and tear of continually writing binaries be too much? Couldn't assemblies be held in memory until deployed/run?

share|improve this question
    
Visual Studio does it for vb.net, and at least partially for c#. This is actually a point in the c#/vb.net eternal debate : codinghorror.com/blog/2007/06/… –  Matthieu Feb 3 '11 at 18:13
    
yeah, I looked at that article. That is mostly in the context of parsing/compiling for error messages, and not so much for instant deployment/running applications –  konrad Feb 4 '11 at 8:11
    
@konrad, Doesn't VB.NET also offer background compilation? –  Pacerier Aug 28 at 19:45

8 Answers 8

up vote 6 down vote accepted

Eclipse does automatic compiling and building. You might want to check out how they do it. It is open source. I think it compiles whenever you save a file.

share|improve this answer
1  
Hooray Eclipse! –  MattC Feb 3 '11 at 15:55
    
That's great, anyone using it? does it make a difference? –  konrad Feb 4 '11 at 8:12
2  
It makes a huge difference. And it is extremely useful for programming quickly -- it can generate methods declarations by a call you write on the fly.I used it for years from development of Java applications, to Web 2.0 applications based on Java, ffmpeg development and extension (in C and C++), PERL, and Python. They have plug-ins for just about every language imaginable. –  Brian Feb 5 '11 at 14:06

Have you ever thought about how many keystrokes you make before you get a file to a state that it can be compiled? Seriously, look at what would happen if you try to compile class f, class fo, class foo, etc. When would you want the IDE to tell you to fix a typo versus just letting one finish typing? I'd question how well have you thought this through in creating something from scratch as that is where I could see this being quite painful really.

share|improve this answer
    
I'm not suggestion that's it compiling the file/class I'm actually editing. But other assemblies that I have edited should be fair game, and other classes in the same assembly as well if you could pull off partial compilation (which probably would be a complex task). There probably would be some issues with resolving dependencies but it shouldnt be unsurmountable. Besides worst case is that it compiles as usual, as long as the compiling thread doesn't bog down the interface or computer too much it shouldn't be much of an issue –  konrad Feb 3 '11 at 0:15

Visual Studio has not give the automatice compilation facility. But yes some IDE's like Eclipse do auto compilation when you save any file. Hope in future versions of Visual studio Microsoft will add this feature.

share|improve this answer

Guess what... if you are using a modern IDE that gives you warnings, it is doing background compilation. Thats how it knows that those items won't compile as is.

share|improve this answer
5  
It's doing background parsing. That's not the same as full compilation. –  Mason Wheeler Feb 3 '11 at 0:29
    
yes of course, but it seems they stop a step short. If some compilation/parsing is done anyways why not go the whole way and use it in the build/run process? –  konrad Feb 3 '11 at 0:30
1  
@MKO: AFAIK, in a lot of IDEs, the parse tree is used in the build process (instead of re-parsing for the compiler) if the source hasn't changed since it was generated. –  Anon. Feb 3 '11 at 0:36

You can always break up a project into precompiled components. I prefer my computer compiles on commmand. One man's cognitive friction is another man's time for reflection and get coffee.

share|improve this answer

If you use Visual Studio and develop in c# or VB Reshaper can do it for you. http://www.jetbrains.com/resharper/ I save alot of time by knowing all the places where my changes to an interface breaks the code without having to recompile manually.

(Also I think Resharper is the shit for many other reasons too.)

share|improve this answer

I don't know, I kind of like having to compile things. It's kind of me wielding my code and telling the computer, "Hah! Let's see you reject THIS!"

Then I get a compilation error, fix it, then, "Hah! Now let's see you reject THIS!"

Then it compiles and I grab some coffee. Feels good. :)

share|improve this answer
    
Feels good..... Except when you have to do that 6500 times in a single day. –  Pacerier Aug 28 at 19:50

Note: This is taken from my experience with Netbeans (Java), so this might not apply to Visual Studio

TMK this is done somewhat in the background when you start editing the file. Unless the IDE knows every single compile error and how to detect it I would assume that it compiles the class in the background then reports any errors.

The issue is when you want to build your whole project. Sometimes I guess not all errors can be caught with this "live" compiling, so it just rebuilds everything. It also might be that the live compiled class contains extra information that the IDE needs but shouldn't be distributed in a binary.

share|improve this answer

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.