C# In-Depth 499
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."
Ads... (Score:3, Informative)
The Printer Friendly version ... (Score:5, Informative)
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++?
Re:Foctothorpe FTW (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:C# is not the most widely used comp language (Score:2, Informative)
note it says "one of computer programmings ..." not "the..."
That means it's not necessarily THE most widely used language, but in a subset of the most widely languages...
In the top 75%? probably
In the top 50%? probably
In the top 10%? maybe...
Re:The Printer Friendly version ... (Score:2, Informative)
Re:oh goody. (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. But you'd know that if you cared to bother looking into it.
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.
Re:C# is not the most widely used comp language (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.
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]
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.
Re:Foctothorpe FTW (Score:1, Informative)
Pretty sure that music precedes unicode, dude, and they write the sharp sign using anything that looks like a tiny smooshed tick-tack-toe board.
At any case, you're both wrong. "E#" is pronounced "eff" - there is a half step between E and F, and the "#" sign denotes "do this note, except take it up half a step."
E#==F.
C# Usage (Score:5, Informative)
It comes nowhere close to the more popular programming languages in terms of usage.
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.
Re:Foctothorpe FTW (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: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.
Re:a bunch of questions (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 uses.
Re:oh goody. (Score:2, Informative)
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.
Re:oh goody. (Score:2, Informative)
Not only that, but the "standard" is of the type anyone with cash can buy.
The .NET "standards" weren't submitted to peer review, in a fashipn like IEEE. Instead, they were handed in a manilla folder to a cashier with a whole lot of money.
Voila, parts of .NET become a "standard".
Basically getting .NET "standardized" was fancy marketing campaign.
Re:oh goody. (Score:3, Informative)
How exactly is C# not open sourced [mono-project.com]?
Re:oh goody. (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: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.
Re:Foctothorpe FTW (Score:5, Informative)
C# is indeed C followed by a musical sharp. But everyone uses the octothorpe for convenience.
Re:oh goody. (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:2, Informative)
(First off, Java was ALWAYS open source, just not OSI-compliant)
But the difference is that Microsoft has committed developer resources to work with the Mono team at Novell. Sun never committed any resources to work on GCJ.
Here's some data that may help (Score:2, Informative)
A quick search yielded this site:
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html [tiobe.com]
Re:a bunch of questions (Score:2, Informative)
Where have you been? System.IO.Compression has been available since, what, the 2.0 framework? Even before that, you always had SharpZipLib.
Re:remember the carnagie melon self guided vehicle (Score:2, Informative)
After a month or so of line by line code inspection the team discovered that the C# code they used had inherent memory leaks and the problem was not repairable
Actually, they did fix the problem... since it was an issue with their code and not C#. C# was doing what it was supposed to.
Re:oh goody. (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 see c# as an improved version of java. The designers of c# learned from their mistakes.
Re:oh goody. (Score:2, Informative)
Objective-C is what you are looking for (Score:3, Informative)
We still don't have a good replacement for C or C++. The big problems with C are 1) the language doesn't know how big arrays are (the cause of most of the buffer overflows in the world), 2) the language has no clue about concurrency or locking (the cause of most of the race conditions in the world).
Objectve-C fits both criteria. You use the found class NSArray for pretty much everything so you don't get buffer overflows, and you have a decent threading model with runloops and Java style @syncronized statements for threading, along with a lot of useful functionality to do common things with threads (like detaching a thread, having a thread run a method after a short delay, etc.). Further helping desktop aps at least is garbage collection, but even when you can't use that the memory model of release/retain is still more easy to use and less prone to having issues.
And, you can always fall back to C or C++ as needed.
E# and F (Score:3, Informative)
Pretty sure that music precedes unicode, dude, and they write the sharp sign using anything that looks like a tiny smooshed tick-tack-toe board.
At any case, you're both wrong. "E#" is pronounced "eff" - there is a half step between E and F, and the "#" sign denotes "do this note, except take it up half a step."
E#==F.
That's actually not entirely true.
It is true that going a half-step up from E gives you F. However, in certain keys you'd still refer to the note as E#.
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...
Re:Foctothorpe FTW (Score:3, Informative)
For example, in an F# major scale, E# is the leading tone and should sound slightly higher than F natural (which would be the lowered tonic) would, due to the tendency to want to resolve to the F#. Of course if you are playing on an even tempered instrument such as a piano, the pitch will always be identical to that of F natural, but pianos are always out of tune for this reason.
I fully expect to be modded down for this embarrassing display of band geekery.
Re:oh goody. (Score:2, Informative)
It hides from the developer that you are actually doing something that could be costly.
For example, that innocent "item.price" could actually be calling an stored procedure that makes all kind of querys to get the right price for the current session customer.
In Java, item.getPrice() would be a hint to this fact. In C#, someone could abuse the property, in different instances of the same item, unaware that he should cache the value to avoid performance hit.
Of course, there are ways to prevent this, but are mostly related to procedures the developers must follow.
Actually, while I really like C#, LINQ, and Visual Studio on the whole (I'm quite happy developing with it), I'm starting to understand why Java had some things that forced the programmer to be explicit about what his/her code did. Not forcing you to catch or throw exceptions means, for example, that methods that couldn't throw an exception (according to it's definition) actually throw them. And you didn't put a try catch because it was a simple call and there were no methods that could throw...
Re:oh goody. (Score:3, Informative)
I had a bad experience with .NET 2, where in order to open an old project in Visual Studio it insisted on converting to .NET compatibility apis. The rather simple program then ran insanely slow, so slow that the interface was sluggish and it was useless for its purpose (automation).
Re:oh goody. (Score:3, Informative)
It hides from the developer that you are actually doing something that could be costly.... there are ways to prevent this, but are mostly related to procedures the developers must follow.
You mean like reading the documentation and/or the source code of the class you're using? If you don't know how or where the object is getting its data, then you're just as in the dark whether it's data passed via a C# get/set or a Java method. Granted the Java method approach is a "clue" that it's not just a member int being set, but I'm not sure that's the ideal way to "get a clue"...
I understand what you're getting at with all this, but at some point familiarity with the road is going to serve you better than guardrails all over the place.