C# and the Compilation Tax

ummmm, Delphi.NET, anyone ?

Case-insensitive, and background syntax checking (if not full compilation). And, pretty good portability between Win32 and .NET.

  • Roddy

Regarding using the same name but with different case, code like this is not uncommon:

Button button = new Button();
Employee employee = new Employee();

etc. Naming is not only about variable names.

If I were sure that people would stick to casing conventions even though the language was case unsensitive, I would have no problem with it. But with current IDE:s and programmers, I guess case sensitivity is a good idea.

Interesting about the background compilation… The Java modules for the Eclipse IDE do it and it’s absolutely fantastic. I know someone is writing a .NET plugin for Eclipse (although I wonder why try to compete with Visual Studio).

It makes me feel a little naked for those times that I use a different editor.

I have a fairly big app (18 prjs) and only ONE is written in VB.NET. Incidentally it was written by JEFF :))) (Unhandled Exception Handler)
I wish Jeff would have written it in C#…

:wink:

If the projects that I work on are any indication, I wouldn’t look forward to background compilation in VS2005 anytime soon – merely typing in the editor pegs the CPU, and the entire IDE frequently freezes while doing something related to Intellisense (usually just long enough for me to lose my train of thought). Throwing background compilation into the mix would probably break the camel’s back as far as me actually getting any work done at all.

Another vote for Resharper. I can write code for hours and be practically guaranteed it will compile. The only downside is that I am afraid to work without it at this point it’s become such a crutch!

i too started with .Net as a VB coder, but i found the little diffreances from ASP to VB.Net fustrating and too simler but not the same so after a week i went to c#, where i have been happy ever since

oh and anyone who dosent get ReSharper is basicly just waanting to waste massive amounts of there own time, Yes VS 2005 has some refactoring but its no where near as good.

buy ReSharper now you will love. it. Hell try it for free for a month then see if you want to go back…

We are forced to code in VB.NET at work, and we all wish the background compiler could be turned off. I have a hi-spec machine, but I still have to put up with 2-3 MINUTES of blocked UI every time I open a file, scroll down a page, press return, paste text, type “.” or “(”, the list goes on.

Come back C#, all is forgiven!

stupid background compilation (like in vb.net) = evil

we had a project with a fairly large number of controls and datasets and stuff (back in the year 2002 or something like that).
everytime you typed in one character something in the background (compilation) took nearly 100% cpu time and the ide wasn’t updating anymore.

compilation on demand background compilation

i want my computer to do what i want and not a 100% cpu time consuming process in the middle of some creative moments where you had to wait that your ide is willing to show you again what you had typed.

Jeff, I’m quite surprised that you see C# and VB.NET as a Pepsi vs Coke choice. You could have been right in the past but I don’t see it that way any more.

You’re right that the choice is more the matter of taste when the only difference is in syntax but C# and VB.NET differ in more fundamental way. C# is statically typed language while VB.NET can behave more dynamically. To be honest, I actually very much like VB concepts even though I hate its syntax (semicolons rule! :).

There are some real world implications. Look at the Jasper project: there is no support for C# language because of its static nature! Now you are hitting real limitations that C# has and VB.NET has not. That’s what I call difference!

As I said, I very much dislike VB’s verbose syntax but on the other hand, there are some sweat benefits of this language. I guess we still have to see the real battle of the throne of .NET languages.

Regards,
Borek

I suggest Eclipse. It’s a wonderful IDE and also Java is a great Programming Language. Eclipse have background compilation and tons of cool features you can’t imagine. Also IntelliJ IDEA is very nice IDE Both are the Best IDE’s on the planet. Visual Studio it is getting old idea from the 90’s. Actually Microsft I really don’t know what they are doing, They did great Tools before but right now they are failing to delivery good stuff.

Background compilation needs to be carefully evaluated before making it a default in the IDE. I take VB.Net as an example. When working with large solutions, with multiple files and projects (one example that comes to mind is dotnetnuke,) it can make the IDE very unresponsive when you’re trying to simply type your code.

Another vote against background compilation. I’d hate it if I were writing up a method and the IDE would constantly paste red squigglies over every little bit of code that doesn’t work yet (because I’m not finished yet, duh!). If Microsoft ever introduces this feature for REAL languages that REAL programmers use then I hope it will be optional!

For the counterpoint concerning the background compiler: first, I was trained in C[++], Java, and C#, so those little semicolons are very near and dear to my heart. The company that hired me is a VB.NET shop, so I learned. To the point: the VB.NET background compiler is crap. I would LOVE to be able to turn it off. The solutions I work on are frequently 20+ projects, and Microsoft has admitted the background compiler has issues resolving dependency trees more than 3 or 4 projects deep. When I open a new solution, the background compiler takes over, making my machine (no slouch - 2.8 P4D, 2G DDR2, 160G hdd) crawl. Opening a comparable C# solution takes almost no time at all. I LOVED the background compiler in Eclipse - it only activated when you hit save, not HALFWAY THROUGH AN IDENTIFIER when you stopped to think. Plus, you could turn it off completely. For the next version of Visual Studio, there better be a checkbox labeled “Enable Visual Basic background compiler” that I can uncheck.

@Damien – NOT TRUE! Look at JScript.NET. It’s lack of support for creating delegates is hardly a Visual Studio issue!

One comment really - why do you feel so insecure about the code you write?
I tend to write whole function / update / idea / sometimes even a little class, before I even try to correct the lines with obvious typos. Then comes first compilation.
It’s not so good to switch between different thoughts and actions frequently. I’d say that correcting some mistakes while writing takes more time than correcting everything when you have an idea complete. When I see that “string” and “1” example, I don’t know what you planned. Maybe it should be string, maybe an int, maybe it should be “1” and not 1.
If you made that mistake, you’ve done something else than you’ve planned - maybe there was a reason - just finish that part and see if your instinct wasn’t better, than planned design… That code won’t disappear - just get back to it later.

It’s a bit like touch-typing - you make some mistakes at first when you’re not looking at the keyboard… but it’s faster to just stop looking - you’ve got backspace and arrows.
Try writing a full paragraph with no spell-checker and don’t correct words - just write your thoughts to the end. Then correct spelling. It will be faster than thinking about spelling and content at the same time.

Jeff:

I agree with you here, but this is all part of what I think is the same principle – the principle of revealing errors as early as possible in a project’s implementation.

We use Continuous Integration to reveal our errors (with unit tests) after every check-in, we use statically typed language to show type safety errors at every compile, and, (the most extreme example), we use background compilation to reveal errors at every keystroke (or line-end).

IMO it’s all part of the same glorious spectrum. Follow this path, and it will be the path to happiness. Divert from it (cough, cough, “classic” ASP/PHP/etc…) and debugging, testing, and implementation of your project seems more and more like its own circle of hell.

I come from a GWBASIC - QBASIC - Visual Basic 5,6 - VB.net, and now finally - C# background. It took only a couple of weeks to become proficient in c# and I agree that the languages are nearly identical. The case sensitivity drives me crazy too and the lack of the background compiler is a huge pain in the butt! In fact, for the last few years the major reason I was a big VB.net fan was not because of the language, but because of the superior support from the IDE!

Changing a variable here, compiling. Changing a line here, compiling…Changing a function compiling…

This approach is indeed wasteful and unproductive. I usually make it a habbit of studying the code thoroughly to prevent hacking it and wasting time like this. A descent amount of time can go by before I compile which in my workflow is okay.

And the longer I wait to compile the more likely the compiler will find code that breaks which is okay. It’s doing its job and checking my syntax. Then I can go through everything and fix my mistakes in usually one or two shots.

As for checking runtime behavior that’s another story but that still requires you to actually run your site or application and play with it to get an idea if it’s working how intended.

This is one of the features I miss in Eclipse.