Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Programming IT Technology

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."
This discussion has been archived. No new comments can be posted.

C# In-Depth

Comments Filter:
  • Ads... (Score:3, Informative)

    by Dannybolabo ( 980836 ) <dannybolabo@gmail.cTEAom minus caffeine> on Wednesday October 01, 2008 @09:32AM (#25217501)
    Why must they make me trawl through 8 pages of ads?
  • by neonprimetime ( 528653 ) on Wednesday October 01, 2008 @09:32AM (#25217507)
    I beg you to use this link [computerworld.com.au] instead of flipping thru all 8 pages
  • Re:oh goody. (Score:4, Informative)

    by ByOhTek ( 1181381 ) on Wednesday October 01, 2008 @09:42AM (#25217647) Journal

    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)

    by mbadolato ( 105588 ) on Wednesday October 01, 2008 @09:46AM (#25217711)

    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

    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" ;-)

  • by ByOhTek ( 1181381 ) on Wednesday October 01, 2008 @09:48AM (#25217743) Journal

    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...

     

  • by Anonymous Coward on Wednesday October 01, 2008 @09:49AM (#25217761)
    Your link did not redirect me to a printer friendly version.
  • Re:oh goody. (Score:3, Informative)

    by GeckoX ( 259575 ) on Wednesday October 01, 2008 @09:51AM (#25217793)

    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)

    by netpixie ( 155816 ) on Wednesday October 01, 2008 @09:51AM (#25217795) Homepage

    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.

  • by Nursie ( 632944 ) on Wednesday October 01, 2008 @09:51AM (#25217809)

    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.

  • by nschubach ( 922175 ) on Wednesday October 01, 2008 @09:54AM (#25217845) Journal

    Looks like it's down to #8 actually:

    http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html [tiobe.com]

  • by Nursie ( 632944 ) on Wednesday October 01, 2008 @09:55AM (#25217859)

    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)

    by fireboy1919 ( 257783 ) <rustyp AT freeshell DOT org> on Wednesday October 01, 2008 @09:56AM (#25217871) Homepage Journal

    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)

    by O('_')O_Bush ( 1162487 ) on Wednesday October 01, 2008 @09:56AM (#25217883)
    According to this: http://www.langpop.com/ , C# is only the 9th most popular language, only competing with scripting languages.

    It comes nowhere close to the more popular programming languages in terms of usage.
  • by jlechem ( 613317 ) on Wednesday October 01, 2008 @10:00AM (#25217943) Homepage Journal

    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)

    by TheLink ( 130905 ) on Wednesday October 01, 2008 @10:03AM (#25218009) Journal

    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)

    by Anon E. Muss ( 808473 ) on Wednesday October 01, 2008 @10:03AM (#25218019)

    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.

  • by BradleyUffner ( 103496 ) on Wednesday October 01, 2008 @10:04AM (#25218037) Homepage

    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)

    by strack ( 1051390 ) on Wednesday October 01, 2008 @10:05AM (#25218045)
    i think you mean "standard encumbered with patents, and not covering the whole libary" and while it is true that it is a interpreted language like java, its syntax is a lot like c++. Although, your probably right. I really shouldn't compare it to c++. thats a insult to c++. Its more like visual basic.
  • Re:oh goody. (Score:5, Informative)

    by i kan reed ( 749298 ) on Wednesday October 01, 2008 @10:06AM (#25218055) Homepage Journal

    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)

    by binarylarry ( 1338699 ) on Wednesday October 01, 2008 @10:14AM (#25218135)

    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)

    by morgan_greywolf ( 835522 ) on Wednesday October 01, 2008 @10:17AM (#25218177) Homepage Journal
  • Re:oh goody. (Score:3, Informative)

    by JasterBobaMereel ( 1102861 ) on Wednesday October 01, 2008 @10:21AM (#25218247)

    "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)

    by bigstrat2003 ( 1058574 ) * on Wednesday October 01, 2008 @10:43AM (#25218609)

    Simple, encapsulation of private variable. Java:

    class foo {
      private int dontTouch;
     
      public void setDontTouch(int newVal) {
    //Determine if we want to allow newVal
        dontTouch = newVal;
      }
     
      public int getDontTouch() { return dontTouch; }
    }
     
    class bar {
     
      public void someMethod() {
        foo ourFoo = new foo();
        ourFoo.setDontTouch(5);
        ourFoo.getDontTouch();
      }
     
    }

    C#:

    class foo {
      private int _dontTouch;
      public int dontTouch {
        get {
          return _dontTouch;
        }
        set {
    //Decide if we want to allow the value
          _dontTouch = value;
        }
      }
    }
     
    class bar {
      public void someMethod() {
        foo ourFoo = new foo();
        ourFoo.dontTouch = 5;
        int asdf = ourFoo.dontTouch;
      }
    }

    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)

    by IIRCAFAIKIANAL ( 572786 ) on Wednesday October 01, 2008 @10:44AM (#25218619) Journal

    C# is indeed C followed by a musical sharp. But everyone uses the octothorpe for convenience.

  • Re:oh goody. (Score:3, Informative)

    by cerberusss ( 660701 ) on Wednesday October 01, 2008 @10:49AM (#25218721) Journal

    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)

    by morgan_greywolf ( 835522 ) on Wednesday October 01, 2008 @11:00AM (#25218893) Homepage Journal

    (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.

  • by SaDan ( 81097 ) on Wednesday October 01, 2008 @11:09AM (#25219035) Homepage

    A quick search yielded this site:

    http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html [tiobe.com]

  • by godefroi ( 52421 ) on Wednesday October 01, 2008 @11:18AM (#25219185)

    Where have you been? System.IO.Compression has been available since, what, the 2.0 framework? Even before that, you always had SharpZipLib.

  • by mc2thaH ( 920212 ) on Wednesday October 01, 2008 @11:20AM (#25219229) Homepage
    I believe you're speaking of this [slashdot.org] story that was covered on slashdot. The problem was not an issue with C#, but an issue with Princeton's code. They were keeping references to objects, which in turn kept them from being released for garbage collection.

    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)

    by eggoeater ( 704775 ) on Wednesday October 01, 2008 @11:42AM (#25219705) Journal

    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)

    by asg1 ( 1180423 ) on Wednesday October 01, 2008 @11:50AM (#25219843)
    Hogwash. Anyone who has spent any time whatsoever with C# in Visual Studio knows the difference between a property and a public variable when they try to assign it. And if you have intellisense off, then the only people who will get confused are those who don't follow any sort of naming conventions. And in that case, they are likely to get confused no matter what language they are in.
  • by SuperKendall ( 25149 ) on Wednesday October 01, 2008 @12:10PM (#25220191)

    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)

    by Tetsujin ( 103070 ) on Wednesday October 01, 2008 @12:15PM (#25220291) Homepage Journal

    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#.

  • by SuperKendall ( 25149 ) on Wednesday October 01, 2008 @12:19PM (#25220379)

    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)

    by cjh79 ( 754103 ) on Wednesday October 01, 2008 @03:09PM (#25223075)
    Actually, E# is pronounced "eeh sharp", and is a distinct note (and in many cases pitch) from F.

    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)

    by salgiza ( 650851 ) on Wednesday October 01, 2008 @03:20PM (#25223247)

    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)

    by nog_lorp ( 896553 ) * on Wednesday October 01, 2008 @05:25PM (#25225023)

    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)

    by Dun Malg ( 230075 ) on Wednesday October 01, 2008 @07:43PM (#25226669) Homepage

    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.

Lots of folks confuse bad management with destiny. -- Frank Hubbard

Working...