C# and the Compilation Tax

OK seriously, if you have to hit compile after every line to make sure you didn’t make any syntax errors, then YOU DON’T KNOW THE LANGUAGE AND SHOULD NOT BE PROGRAMMING IN IT.

I hope to god you don’t have a real development job. It scares me that people out there are writing code and have no idea what the hell they’re doing.

Jeff,

I encourage you to go a week with minimal automated code-correctness checks. When you’ve gotten to the point where you rely upon continuous automated checks (which can miss a tremendous number of problems where the code is syntactically and type correct, but logically broken), you’ve seriously harmed your craftsmanship.

http://www.yafla.com/dennisforbes/Edit-and-Continue-Valuable-Tool-or-Sloppy-Vice-/Edit-and-Continue-Valuable-Tool-or-Sloppy-Vice-.html

Just a heads-up: Arrays are 0-based in VB.Net.

If you want good IDE:s, you should consider switching
to Java and check out IntelliJ IDEA and Eclipse.

I have to strongly disagree about using Java. I am so sick of getting Java interfaces. They are slow, buggy, and resource hogs. If someone can come up with a compiler/installer that makes them executables when installed, I can stand it, until then Java should not be used for delivered apps.

In ancient times, the programmer’s world was almost entirely filled by the ferocious punchcards and the angry reports. Programmer could meditate, read reports, punch some cards, meditate again and - when the Machine Time had come - he fed the evil god, with tremor and fear.

Now, where any report is? Or so called “cross-reference”? How can the programmer just make attempt to meditate, having nailed his eyes to the screen and his fingers stuck to the keyboard. Due to lack of meditation, the SHIFT-CTRL-B obsession came. Let’s not cry for this, i LOVE this. What about you?

Background compilation only saves time when you are working on relatively small projects, on large ones it is a huge hinderance to productivity.

I use both VB.NET and C#, i find VB very verbose yet also very easy to use in throwing up a small quick application. C# is just the natural language for the .NET platform, while VB.NET has inherited its relationship with VS from its not so gifted predecessor… :slight_smile:

The second I finish typing the assignment (e.g., move my cursor off
the second line), the statement is flagged as an invalid assignment.
No compilation necessary; it automatically appears as an ambient
squiggly underline in the background.

I don’t know why you don’t also get the squiggly line in C#, I do.

wow, I had no idea that the C# IDE couldn’t catch errors.

You might want to get over the case sensitive issue, by the way. It is pretty obvious that any given variable SHOULD ALWAYS be typed in the same exact case… So perhaps instead of case sensitive we should call it “Case Locking”. I would be outraged if a compiler let me do this:

int bob=7
Bob=boB+2

The compiler must reject the second line because of the undefined variables.

Also, if you must stick with an IDE that can’t tell you about errors without compiling (I still can’t believe such a monster exists!), you might want to go a little XP–as long as you’re compiling anyway, throw in some test-first methodology and run the tests whenever you compile.

no
yes
no

no,
I don’t agree with you on the multiple language thing. It’s really nice to be able to use a dll compiled in vb.net in for example powershell, F# or C++ without ANY issues at all. The fact that you have to do this in separate projects is a non issue to me. I think there are very few people who want to use more than one language at the same time. But there are a lot of people who want to collaborate with people that use a different language.

yes,
I kinda agree with you on the case sensitivity thing. I think it’s a good idea if C# wouldn’t allow you to give two entities the same name although i wouldn’t mind if the compiler would still be fussy about case and give warnings. I think t’s bad even in case insensitive languages to use different casing. But the vb-editor kinda solves that for you by fixing your code while you type.

no,
I absolutely hate background compilation. On bigger projects it slows down my computer and it bugs me when i’m not yet ready typing my code. Sometimes it even locks up my computer (dual core with 2gigs of memory) I’m used to hitting ctrl-s once in a while to save my code so i don’t really mind hitting Ctrl-shift-B after that. It might be better if this was automated but i don’t really care. I can fly in C#… I crawl in VB…

I made a good living from VB6/VBA for well over a decade. And I still spend a good portion of my time in Excel/VBA even now. Which is the principal reason I accepted the annoyances of C# rather than take the more “natural” evolutionary step of VB.Net. The cognitive dissonance would have been too unpleasant. Moving to C#, having avoided C++ almost completely and not having really touched C since the mid-nineties, was really rather pleasant.

And I use F6 rather than Control-Shift-B. Middle finger of right hand is most satisfying.

Of course, this is silly:

Button button = new Button();

…that looked stupid even before I learned Ruby.

Oh, and I think Matthijs has most likely not seen the the VB IDE - if he could stand to be without the “button/Button” “standard” I think he’d rather like what VB could do. It’s probably what I most miss when I switch from Excel to VS.

A few things…

First, VB will be around in some form as long as Bill Gates is around. It was his baby, and that paperweight will not go away until he does.

Second, I have always been a Borlan fan… From my first experience with Turbo Pascal and C and ultimately Delphi. I just like the Borland IDE. Most likely because it is familiar and that is always nice.

So, I guess it all boils down to what you know. If you started with VB probably like that tool… I started with Borland, so I like that tool. I am starting to like Eclipse and Java - because the place I work pays me to do it that way… Ultimately, I am a big whore and with a family I can’t afford to be a zealot on any one technology or platform…

Wayne

Have you seen the stuff coming in VB 9 and 10? The languages are certainly are diverging and VB is getting a ton of stuff not foudn in C#.

Mutable Anonymous types
http://www.infoq.com/news/2007/05/VB-Anonymous

XML Literals
http://steve.emxsoftware.com/LINQ/XLinq+has+me+wanting+to+code+in+VBNET

Scripting, REPL, Dynamic Objects like Ruby/IronPython
http://www.panopticoncentral.net/archive/2007/05/01/20383.aspx

Jasper, which C# doesn’t support
http://blogs.msdn.com/aconrad/archive/2007/04/30/project-jasper.aspx

Silverlight 1.1/runtime compliation
http://blogs.msdn.com/vbteam/archive/2007/05/01/vb-on-silverlight.aspx

It has been a rough few years for VB fans, but things are going to get much, much better, especially when Silverlight 1.1 comes on the scene.

Wow, I really disagree with this artcle. Two things:

  1. Case insensitivity is a GOOD thing. I would go absolutely nuts if I poured through some source code I was asked to take a look at and saw the following different ways a class was instantiated:

new MySuperClass()
new MYSuPeRClAsS()
new mysuperclass()
new MYSUPERCLASS()
new mySuperClass()

Variable names would be even worse. Imagine accessing a variable 10 times within a method, and a typo / pure laziness on the part of the programmer ended up with 4 different capitalisations for that variable. Hey, the compiler doesn’t enforce it, so why should they?

Over the course of reading source code for even a moderately sized system, your brain will waste significant energy just slowing down and reinterpriting what has been written, to make sure that, yes, it’s just the capitalisation of the variable that’s different, it really is the same variable.

Your brains’ ability to automatically “scan” the source code is virtually eliminated, so instead of concentrating on the logic in the code, you’re concentrating on slowing down, reading and understanding the names of the variables. This is a monumental waste of brain power and of time. You say that case sensitivity would make programming more about “people”, but I emphatically disagree. This would make things HARDER on us; we would tire more quickly because of the unnecessary concentration required to decipher these capitalisations, and it would slow us down.

The end result would be that companies would have to institiute a variable naming policy that says capitalisation must be a certain way; in that case, there’s absolutely no reason not to have the compiler enforce it in the first place!

  1. Re the “compilation tax”. Others have addressed this but I will as well. My development machine is decent, but I could have many applications running - Word, SQL Management Studio (which implies the SQL database engine is running), several pages of Firefox, UML modelling tools, text / log files, and of course VS. I would find it absolutely inexcusable for the IDE to decide of its own volition to constantly compilie my code, eating away at my system resources and chewing up clock cycles. For a large project, this would be unbearable.

So yeah, I can’t find myself agreeing much with this article.

I have to admit that I don’t completely agree.

First, a quick note on case-sensitiveness. You say that ‘As an advocate for people over machines’ you think case-sensitive languages are wrong. I’m a developer, but a person too… I’m a suer most often than not. I’m a ‘business expert’ in whatever activity I engage in regularly. And to me, ‘Banana’, ‘BANANA’, ‘banana’, ‘bAnAnA’ (and derivatives) are different words, different concepts. If I type them differently, there must be some reason for it. So, sorry, I think case-sensitiveness is ok, even from a ‘people’ perspective.

Secondly, the compilation tax that comes with C#.
All right, I’m not going to get in the whole religious debate of compiled vs interpreted languages. The bottom line is that each type of language has its own place.
However, I don’t think that the comparison of C# vs VB.NET in regard to the ‘background compilation’ is quite fair.
At work, I have Resharper. At home, I don’t. Even without it, Visual Studio seems fairly reactive in pointing out issues with the code I just type. At least in the 2005 version.
Definitely, Resharper, and other similar tools, help the developers out and are worth their price, but one can live even without them.

Don’t take me wrong, I completely understand your point of view. Here at work, our current project is rather large, and keeps on growing. We ran a few tests, and it takes us at best 40 seconds to build the solution on our machines. At home, it takes me at worst 10 seconds to build the same solution. The fact that we looked into this sort of comparison should demonstrate that we are painfully aware of the cost of building (take those 30 seconds, multiply them by the average number of builds each of us is doing every day, by the number of developers on the team, and you actually get 6-to-8 hours of time. So we’re debating whether it costs more to upgrade our PCs, or to add a new developer to the team).

Sure, the compilation step is an annoyance, and developers should constantly be on the lookout for ways to minimize its cost. However, things like the ‘background compilation’ feature are merits or drawbacks of the IDE rather than the language.

No ?
Thanks for the thought-provoking post as usual,

I think the problem is that there is a compilation step in the first place. Why I just can’t run my application right out of source code? I wish JIT compiler would be able to accept raw VB.NET or C# just like it does MSIL.

It can, if you are using VB 10. Or at least that is what they are planning.

Err, obviously, I meant to say that case SENSITIVITY was a good thing, not INsensititivy. :confused:

ps.: I liked your comment about case sensitivity. I’d like to see something different in the future: a compiler that automatically adjusts the case of your code.

VB has done that for over a decade.

Hey hey! Finally a spammer slipped through the orange filter! Amazing it’s worked so well thus far though :slight_smile:

Good list, Jonathan. Let me pile on about the VB9 XML code literals features. This builds on LINQ support in Visual Basic (which is very good), the new LINQ to XML (nee XLinq) API and of course the inherent ability to late bind types in Visual Basic (which is the key difference from C#, as Erik Meijer points out in many searchable places on the web). I should also say that this isn’t just the VB9 compiler; the XML language service in VS will pick up on dynamic type information where available in XSD’s and provide Intellisense for attributes and elements (and the XML code literals switches the literals into XML mode).

If you haven’t actually tried this stuff, you won’t believe how productive it is. If you’re a regular programmer who deals with XML config files, XML message fragments, XML document scanning, XML report production (yadda yadda yadda) then I think you’ll love it.(Tom, I’m looking at you here.)

http://blogs.msdn.com/xmlteam/ for XML love
http://blogs.msdn.com/data/ for links to Jasper et al

ObDisclosure: yes, I work at Microsoft, on this stuff

Haven’t you just recently said something about Visual Studio 2005 being the best IDE ever?

I have to agree with some comments, go try Java Jeff. It has kinda the syntax of C# and Background-Compiling.
I personally use Eclipse, which I think, is just one great IDE, but IntelliJ seems to be pretty awesome too. (though its not free)

I have to strongly disagree about using Java. I am so sick of getting Java interfaces. They are slow, buggy, and resource hogs.

common, thats not true, go use SWT if you think Swing is to slow (which it really isnt anymore)