Slashdot Log In
C# In-Depth
Posted by
CmdrTaco
on Wed Oct 01, 2008 08:25 AM
from the does-he-mention-that-it's-evil dept.
from the does-he-mention-that-it's-evil dept.
Bergkamp10 from ComputerWorld writes "Microsoft's leader of C# development, writer of the Turbo Pascal system, and lead architect on the Delphi language, Anders Hejlsberg, reveals all there is to know on the history, inspiration, uses and future direction of one of computer programming's most widely used languages — C#. Hejlsberg also offers some insight into the upcoming version of C# (C#4) and the new language F#, as well as what lies ahead in the world of functional programming."
Related Stories
Submission: A-Z of Programming Languages: C# in-depth by Anonymous Coward
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Ads... (Score:3, Informative)
Re:Ads... (Score:5, Informative)
Just click the "Print this story" button and you can read the whole thing on one page, without ads. This trick works on many sites.
Parent
The Printer Friendly version ... (Score:5, Informative)
Foctothorpe FTW (Score:5, Funny)
I am a sad case and find much amusement in the fact that the "correct" name for the # symbol is octothorpe, which means "C#" should not be pronounced "C-sharp" but Coctothorpe.
Imagine my joy on discovering that they've scoured the alphabet and have managed to find a new initial letter that makes an even funnier name.
Ladies and gentlemen, let us welcome the new language, F# or Foctothorpe.
Re: (Score:3, Informative)
Er, haven't studied much music, eh? Personally I don't recall anyone ever saying anything to the effect of "This time,let's try Bach's Bouree, but change the key to E octothorpe". E# is pronounced "E sharp" ;-)
Re:Foctothorpe FTW (Score:5, Informative)
That'll be because music uses sharps (i.e. unicode symbol 266F) rather than octothorpes (unicode 0023)
E followed by unicode 266F is indeed E sharp
E followed by unicode 0023 is E-octothorpe.
Parent
Re:Foctothorpe FTW (Score:5, Informative)
C# is indeed C followed by a musical sharp. But everyone uses the octothorpe for convenience.
Parent
Re: (Score:3, Interesting)
C# is indeed C followed by a musical sharp. But everyone uses the octothorpe for convenience.
If I had mod points I'd give 'em to ya but instead I'll just reply that you're correct. :) In fact the C# standard (don't have the link handy) specifically states that although sharp is the "correct" glyph to use, the octothorpe is an "accepted" alternative due to the lack of the former on keyboards.
Re:Foctothorpe FTW (Score:4, Funny)
Somebody should trademark C octothorpe, and sue Microsoft for every place they've used the wrong character.
Parent
Re: (Score:3, Informative)
I haven't really checked but it might depend on which "temperament" you're using.
See: http://en.wikipedia.org/wiki/Musical_temperament [wikipedia.org]
This might have E sharp not being F:
http://en.wikipedia.org/wiki/19_tone_equal_temperament [wikipedia.org]
Re: (Score:3, Insightful)
On a piano keyboard to play E# you press the same key as for F, so it gives the same sound. But I *think* this is not true for every instrument. Some instruments can produce different sounds for E# and F. Then there are the considerations of music theory and notation which others have pointed out.
You're missing the most radical language of all (Score:4, Funny)
The Roctothorpe!
*insert headbanging graphic here*
Parent
Re: (Score:3, Funny)
a bunch of questions (Score:5, Insightful)
Could it be that C# is one of the most widely used simply because of the installed base of windoze machines all over the world and not because of any technical merit? Most current languages have compilers and interpreters that run on windoze; what makes people choose C# over the others? Just how much impact has C# had on computing sciences as a whole, anyway?
Re:a bunch of questions (Score:5, Informative)
Looks like it's down to #8 actually:
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html [tiobe.com]
Parent
Re:a bunch of questions (Score:5, Informative)
8th most widely used.
After Java, C, C++, Visual Basic, Python, Perl and PHP. It just beats out javascript, below that you get into the obscure languages.
Parent
Re:a bunch of questions (Score:4, Interesting)
The first project converted 12 C++ programs to one, far more flexible Java program (that runs 12 times). The nightly run is now 30 minutes instead of two hours and hasn't had an abort in two months. In fact, the operations manager was very nervous for awhile because he wasn't getting paged on the weekends and kept checking the system.
We could have done the same thing in C++ or C#, but they offered no discernible benefit and are more complicated to use for what we are doing.
Parent
Re: (Score:3, Insightful)
Re:a bunch of questions (Score:5, Interesting)
I've tried a number of apps in mono under frebsd (you need lang/mono and x11-toolkits/libgdiplus). Threads, UI, Sockets, SSL sockets, etc. all seem to work fine. Compiled in Visual Studios 2003. It's not even bad as a cross-platform application.
Conversely, in Suns own Java implementation, going between Windows and HPUX, I've run into issues simply with the regular expression parser of the /find/ function of the String library.
I'm not saying .NET is perfect by any means, but it's certainly not bad framework either. It's decent for cross-platform apps. Everything has it's flaws, nothing is perfect, etc.
Yes, I know, there is always a chance MS will say "No more!" to the mono project. As I said, nothing's perfect.
Parent
Re:a bunch of questions (Score:5, Insightful)
ehh? You do realize that VB.Net is not VB6. When you choose to not use the Microsoft.VisualBasic namespace, which merely contains an abstraction layer to allow VB6 programmers to be more comfortable in .Net, it actually hardly merits the name VB.
For the most part, the only differences between c# and vb.net are syntax. Begin...End, For...Next control structures rather than brackets is the biggest difference.
I wrote c# at my last job for a couple of years. At my current shop, they're a vb shop and brought me in to bring things up to .Net. Since all the current devs were vb6 devs, they wanted the easiest path for them to migrate into .Net, thus I had to start working in VB.Net. At first, I dreaded it..but very quickly realized that it's all just .Net, and the VB.Net and C# languages are very comparable, both being just as easy to work in.
Bottom line, you like curly braces? Use c#. Don't care? Then use whichever you like.
Parent
Re: (Score:3, Informative)
Actually, that isn't right either. Microsoft.VisualBasic isn't the compatability layer, it's the VB runtime. It just provides a few extra function that *look* like VB6, some of them don't even behave the same. The actual computability layer is in Microsoft.VisualBasic.Compatability, It's the library that is responsible for doing the weird stuff like giving you collections that start at 1 instead of 0 and other strange stuff. Microsoft.VisualBasic follows all the standards that any other .NET library use
C# is not the most widely used comp language (Score:4, Insightful)
>>one of computer programming's most widely used languages.
I highly doubt that a language that has only been around for a few years is the most "widely" used computer language. Cobol, fortran, or standard C , maybe.
Re: (Score:3, Informative)
Apparently Java is the top dog today.
My personal favourite, good 'ol C is in second place. C# was in at number 8, and seems actually to be on the decline.
C# Usage (Score:5, Informative)
It comes nowhere close to the more popular programming languages in terms of usage.
Meh. It's alright. Not great yet. (Score:3, Funny)
I'm a little surprised at the ease to attack C# but not much. It actually does a few of the things that C++ folk would like over Java, but I can understand the comparisons with Java.
Anyways, I've been fooling around with it for a while via an O'Reilly book and so far it's not too bad. That said, I don't see it much use beyond the Windows .Net Framework. Then again, that's all employers seem to want to see on the resume nowadays when it comes to development. And who can blame them?
I do have a cause for concern though....
The fact it feels like he's faking the enthusiasm, as he did for most of this dumb interview, is slightly scary. The followup question confirms that
Lastly...
It is possible to build alternate implementations. We are not building .NET for Linux, because the value proposition that we can deliver to our customers is a complete unified and thoroughly tested package, from the OS framework to databases to Web servers etc.
Ummm....just because it's possible to build an alternate implementation doesn't mean it will work the same way. It would absolutely kill me to use a language that implements two things differently because MS wants to hold back special class $VERY_IMPORTANT_FUNCTION that is the paramount to the language, such as database or socket connectivity.
I seriously hope that Java being opened helps chop block this. With open code, my hope is more places will buy into the language, showing MS that a "industrial-strength" language can be free.
Re: (Score:3, Interesting)
The fact it feels like he's faking the enthusiasm, as he did for most of this dumb interview, is slightly scary.
Of course Anders Hejlsberg is faking enthusiasm... just like for instance Bjarne Stroustrup about C++ and C++0x.
In both cases the language features they chose to include cause incredible amounts of complexity. At first they are all excited about all these cool features... but then when they get to the gritty, like for instance getting C# to beat Java in performance (it doesn't come close), they start tearing their hair out.
For instance, one big reason Java did not include 'real' generics is because it had n
A note on F# and Ocaml (Score:3, Interesting)
I think that one of the most interesting developments of C# and most mainstream programming languages is that they keep borrowing long-established elements of functional programming.
All and all this is a positive development. The only irritating aspect about it is the number of Microsofties who think M$ is inventing new stuff and being "innovative(TM)". A good example of this is F#: while the language is basically an adaptation of Ocaml [inria.fr] to the .NET environment (to the point that simple programs are indistinguishable), I've seen plenty of people touting F# as the best thing since sliced bread, but completely failing to mention its roots, or the fact that Ocaml is a well-established language with a long history, and perhaps the most successfull (in terms of actual usage in the industry) of functional programming languages.
(Though I give credit to the interviewee in this particular article for being an exception to this rule, and for acknowledging F#'s pedigree).
Incidentally, this has long been a burning question for me: why is a language like Ocaml ignored to such an extent within the mainstream open-source community? It already has a small but vibrant community, excellent coverage in terms of libraries, performance comparable to C++, and the safety and cleanness that comes with functional programming. I even see Linux people excited with F#, seemingly oblivious to the fact that we *already* have a language better than F# that runs natively under Linux!
(Note: I consider Ocaml to be superior to F# because in the process of transforming Ocaml into F#, Microsoft removed two of the most interesting and powerful features of Ocaml: functors and polymorphic variants)
That's what *# does, dumb down languages (Score:4, Informative)
Incidentally, this has long been a burning question for me: why is a language like Ocaml ignored to such an extent within the mainstream open-source community? It already has a small but vibrant community, excellent coverage in terms of libraries, performance comparable to C++, and the safety and cleanness that comes with functional programming. I even see Linux people excited with F#, seemingly oblivious to the fact that we *already* have a language better than F# that runs natively under Linux!
(Note: I consider Ocaml to be superior to F# because in the process of transforming Ocaml into F#, Microsoft removed two of the most interesting and powerful features of Ocaml: functors and polymorphic variants)
I can't exactly answer why other languages don't get more play - but I can lament that the .Net platform has been responsible for draining some of the life out of every language they touch. I still remember a very excited Eiffel proponent being very excited about Eiffel# when it first came out - not realizing it was a gateway for Eiffel users to flow to pure C# programming.
Perhaps F# is a true move by Microsoft to switch everyone to functional programming, but it could just as easily be a trick to get people using the .Net platform and then through convenience get them to move naturally to C# from there...
Parent
Re:oh goody. (Score:4, Informative)
It's closer to Java than C++. Much closer. Would you call Java a 'slightly altered and nonstandard and proprietary' version of C++?
Parent
Re: (Score:3, Informative)
How exactly is C# not open sourced [mono-project.com]?
Re: (Score:3, Insightful)
Yeah, it only took twelve years for that to happen. I guess C# just won't get around to it for another five years.
Re: (Score:3, Informative)
Either a troll, flamebait, or spoken in ignorance.
Languages evolve, and anyone that knows c++ and c# knows that what you have stated is patently untrue. Not interested? Then don't bother, but until you do your research, please refrain from throwing in your apparent 2 cents worth...it's not really worth that much.
As has been stated already, the CLR is in fact a standard, and c# has more in common with Java than with c++. It's an evolutionary language, and it is very popular for a lot of very good reasons. Bu
Re:oh goody. (Score:5, Informative)
Your reply indicates you have new clue what C# is. C# is not a direct descendant in design from c++. C# is a child language of Java more than anything. You could probably convert 90% of C# code directly to java with a simple find/replace regex for keywords.
C# is also not non-standard. The C# language has a published standard, which, while not open source, is not the same as non-standard. A number of other implementations exist for both the virtual machine level(e.g. mono, boo) and the compiler/ide level(e.g. sharpdevelop)
C# more tolerable than java in terms of ease of design and naturalness of the language, and good for a similar scope of projects.
I like the ability to release windows binaries without having a headache about version compatibility, the irrationality of the underlying windows API, or memory leaks in trivial portions of code.
C# is not the best language for all sorts of problems, but when it comes to banging out a GUI .exe for windows users to use quickly, I don't think there are better choices.
Parent
Re: (Score:3, Informative)
"C# is not the best language for all sorts of problems, but when it comes to banging out a GUI .exe for windows users to use quickly, I don't think there are better choices."
Delphi - Simpler, Faster, less overhead, By the same author!
Re: (Score:3, Informative)
when it comes to banging out a GUI .exe for windows users to use quickly, I don't think there are better choices.
I've got a Q and a t who think otherwise. Product page: http://trolltech.com/products/qt/ [trolltech.com] Wikipedia: http://en.wikipedia.org/wiki/Qt_(toolkit) [wikipedia.org]
Re:oh goody. (Score:5, Interesting)
Having spent the last seven years using Qt and C++, and the last two comparing that with C#, I'd agree with the original poster: C# is a better choice for fast productivity to a GUI .exe for Windows.
Throw other platforms into the mix and my decision changes, but that's not what he stated, is it?
Qt lost a lot of points in my book for just how much time was destroyed in porting our code to Qt4. Two years later, and we're still asking for bugfixes.
Parent
Re:oh goody. (Score:4, Informative)
Simple, encapsulation of private variable. Java:
C#:
The implementation is about the same in both languages, but using it is much nicer and cleaner in C# than in Java.
Parent
Re:oh goody. (Score:5, Insightful)
The implementation is about the same in both languages, but using it is much nicer and cleaner in C# than in Java.
That really is a matter of opinion. In Java, it's pretty clear that you are requesting or modifying a property of the object. In C#, you are using assignment to represent that mechanism so you might be accessing a public member variable directly or calling a method to achieve that end. To me, the Java method is more explicit and therefore less prone to error.
Cheers,
Toby Haynes
Parent
Re: (Score:3, Informative)
In Java, it's pretty clear that you are requesting or modifying a property of the object.
Really? The paranthesis after the method name inclines me to think of it as a function, and I prefer using assignments vs a function call; it's easier to read and debug.
eg. blah.Prop = someFunct(); is easier to read than blah.setProp(someFunct());
In C#, you are using assignment to represent that mechanism so you might be accessing a public member variable directly or calling a method to achieve that end.
Which is kind of the point... a property is exposed as if it were a public member. I don't /care/ if I'm assigning to a property or a public member.
To me, the Java method is more explicit and therefore less prone to error.
What? Can you give me an example of how it is less prone to error?
I program in Java too, but I prefer c#. I se
Re:oh goody. (Score:4, Interesting)
Yeah, that was what I thought before I started using C#. I am a 10+ year veteran of the Java world, and have spent the last year or so on a large C# project. C# has much better syntax in every way that it deviates from Java. Properties are quite clear, since VS does a nice job. Under the covers, there is *no* difference between a property with an implicit getter/setter (i.e. you didn't provide one, so you access the variable directly)--the bytecode creates a synthetic get_ and set_ method, allowing things like AOP to work even if no explicit getter/setter is provided.
The Java method results in much more verbose boilerplate code. This also causes many developers to do more cut-and-paste, another source of potential error. The Java method makes tech like AOP much harder, as there is no synthetic method call surrounding access to public member variables. The Java method is, in short, not object oriented, as it does not properly abstract away property access, so Java tacked on this stupid getXXX/setXXX naming convention in the JavaBean standard.
There are many reasons why Java is a superior platform than .Net/C# (maturity of 3rd party libraries, the open source community, the quality of design in the provided libraries). But the language itself is not one of them. I cannot think of a single area where Java bests C# in terms of the language itself. C# really is the next generation of Java, and has learned from Java's mistakes.
Parent
Re:oh goody. (Score:4, Insightful)
Java: Properties are private variables/methods exposed through a public method. Seems unnatural and tedious when accessing a guarded variable, e.g.
Line.GetWidth(); Line.SetWidth(10);
Two different calls for accessing a single property.
C#: Properties are private variables/methods exposed through a public variable. May be cause for surprise e.g. when
Line.Width++
increases width and executes statements outside the scope of width increase.
For exposing a (guarded) private variable I prefer the C# way, but it's too easy to mix data with flow.
I don't feel a property can be accessed as either a variable or a method, because it isn't and adds to confusion.
Parent
Re: (Score:3, Insightful)
Re:amazing what doesnt get asked (Score:5, Interesting)
I'm curious, what gives you the idea that C# fragmented "the whole programming scene"? As far as I can tell, C# has really just replaced C++ on the Windows client side, where Java never had a foothold to begin with.
So, where is this fragmentation you speak of?
Parent
Re:amazing what doesnt get asked (Score:4, Interesting)
Well there is fragmentation produces as they introduce YET another language.
You currently cannot say C# replaces C++ on Windows platform as using any DirectX components for example is nightmare through C#. Which I think is a rather major obstacle if you have an application that would like to use something other than simple sound output facilities. (Reasons for this might be as simple as choosing a sound output device, on at least .NET 2.0.)
More on the major downside of writing .NET applications is that you cannot guarantee that the stuff I work on my Vista workstation works on my co-workers XP workstation. This is a very sad "feature" that has been bugging as even with very simple applications. (Side note: We have tried to code using all the best practices you can find from MSDN.)
Also, GP's point 3 sounds very interesting. Can it be a success when it cannot be used to produce major parts of their own operating system. (No, I'm not talking about writing their kernel with C#).
Though, the GP doesn't list any sources for point 3, which at least I would be very interested to read as I seem to have missed those articles.
Parent
Re:amazing what doesnt get asked (Score:5, Insightful)
Well there is fragmentation produces as they introduce YET another language.
So? That's a problem for Windows developers. Why should a Java programmer care? In the realms where Java is popular, C# has had basically no influence. So MS has, at worst, fragmented the Windows development ecosystem... big deal. :)
You currently cannot say C# replaces C++ on Windows platform as using any DirectX components for example is nightmare through C#.
...
More on the major downside of writing .NET applications is that you cannot guarantee that the stuff I work on my Vista workstation works on my co-workers XP workstation.
But none of this has anything to do with fragmentation to begin with. You're getting off-point. And that's ignoring the fact that, once again, this is a problem for MS... the rest of the programming world doesn't care one whit how hard DirectX is to integrate with C#.
Can it be a success when it cannot be used to produce major parts of their own operating system.
Last I checked Java wasn't being used to write operating system components, yet no one claims it's a failure. Now, that's not to say C# and .NET are unbridled successes, but that's a pretty crappy metric for making the call.
Parent
Re: (Score:3, Funny)
Yes, it must be one of the most widely used, because it seems that every day I hear of .NET failing to scale somewhere.
Re:One of the most widely used languages? (Score:5, Informative)
I can feel my Karma burning here but in my office we run into this issue with a lot of MS products. SQL Server 2000 ........ Upgrading is not an option since the DoD just approved SQL Server 2005 for classified use. Apparently 2008 is the bees knees but come on 8 years to get your shit straight? And we've also run into massive problems getting asp.net applications to scale. We've found MS best practices while certainly easy are not very efficient behind the scenes and cause massive slowdown when used on a large scale. And after using their ajax toolkit I wouldn't touch that thing with a ten foot pole.
Now I might sounds like I'm bashing .net a bit. But .net products do have their time and place. I code in C# almost everyday. But for anything Enterprise I would think twice about it.
Parent
Re: (Score:3, Insightful)
Could that be partly due to the fact that a literal monkey could code it? Hell, most of the code you'd ever need for any program has been posted by some Microsoft programmer on MSDN so the only skill developers have to know is cut and paste. I don't know how many times I've looked through code with myObject and myHttpWebRequest because the developer was too lazy to even change the variable names to fit the purpose.
Re: (Score:3, Funny)
Re:Oh, well, that explains everything... (Score:5, Interesting)
Dude, you seriously need to stop sipping the red bull or whatever your drinking...
Turbo-Pascal was a god send to the programming world. It was an entry point for 10's of thousands of programmers and I am one of them. It was the 1st IDE, write your code then compile and run in one key press! No one had that, not a single company. Yes it was limited to 64K of code and data and only made an image ( com file ), but what you could do in that 64K was beyond anything else at the time.
Say what you will about Anders going over to the dark side, I mean until then he was my personal hero, but there is no denying the mans brilliance. Turbo Pascal for Windows? Again, no company had anything remotely close to that and he was the architect. Delphi... Again, no one had anything close to that, and he was the architect.
The OOP model that came out of Borland made C++ look exactly like the joke it was and is today. Their model was infinitely superior, and again, he was the architect.
The demise of Borland was mostly about Microsoft's malevolence and monopolistic ways. If MS had wanted actual competition, more then likely we would would all be programming in Borland languages to this day, instead of the shit that comes from MS which most of Anders has a hand in, but is corrupted by the MS Marketing machine making technology decisions.
Parent