What's so great about C#?

This is a discussion on What's so great about C#? within the C# Programming forums, part of the General Programming Boards category; I see a lot of people moving to C# & I don't get it. I still see C++ as the ...

  1. #1
    Registered User
    Join Date
    Jun 2007
    Location
    Usa, Pa
    Posts
    39

    Cool What's so great about C#?

    I see a lot of people moving to C# & I don't get it. I still see C++ as the faster & most flexible langauge.


    What makes C# so great that almost everyone uses it. I even see companies move on to it, not completly out of C++ but moving into C#. Also, will C++ be discontinued like they did with VB6? I really want to know everything about C#.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    C# is a Microsoft product - very few others make compilers for it. It is an alteranative to Java in a Windows environment, as far as I can tell. Benefits and drawbacks are both similar to Java.

    C++ is an internationally accepted language standard implemented by several different compiler manufacturers/producers, for a large range of machine and OS architectures.

    Whether you see the benefits as greater or lesser than the drawbacks will depend on many things, such as:
    - What your application does.
    - What your target environment is.
    - Need for Time To market vs. code execution speed.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109
    Alot of companies here have already switched completely to Java or C# (.NET in general).

    I dont know the reason but it seems that even though one is working trough a VM speed isnt really a problem. This doesnt mean not a single line of C++ or whatever will be written for a whole project.

    For example a project like real time stockmanagement , that includes the machines to read the bar codes and process them, the wireless network where it connects to etc,the database to store everything, the interface where users can view stock , see which items are being scanned etc etc... ).

    The interface will be written largely (if not all) in C# (or any other .NET language but preferred to be C#) or Java. Reason: the simplicity of building a nice interface at a fast pace (compared to plain function calls to win32).

    The machine that reads the barcodes etc , will probably have some C (code) or C++ classes to interact with the guts of the machine (as in low level). The interface for this machine will probably also be in .NET or Java. Reason: again the simplicity of creating forms and the like.C code or C++ classes can be called from within .NET or Java so interaction from the low level to the interface is not a problem.

    I personally have more experience with .NET then Java or even C++/C but from what I've seen in Visual Studio and all the professional tools that come along. It is a (in my opinion) great development environment. I've never had such easy debugging tools, gui editor, database interactivity as I have with the .NET framework.

    In the end , what matters is , does the customer care that his application in C# is maybe somewhat slower (not even noticable slower for the human perception) then as it would be written completely in C/C++ ???

    The difference for the customer lies in my opinion especially in the development costs and the maintance costs.

    If one can choose between an application that is somewhat slower (like I said before not even noticable by a human) but alot cheaper then the somewhat faster version. And if this marginal speed is the only drawback then he would certainly choose for the cheaper application.

    I'm not totally advocating for .NET , Java or anything that uses a VM. But it's like matsp said already: what is your target environment , what kind of application are we developing etc etc...

    Suppose we are developing a game that relies and fast execution , that has to have great graphics etc etc and all this without needing a supersystem... then I shouldnt tell you that writing something like this in .NET or Java is not the way to go (some parts of the game could be written in .NET , for example a map editor or something alike).


    Anyhow, this question has been asked alot of times and it always comes down to the same thing: use the right tool for the right operation.

    It's like asking, should a surgeon use a chainsaw or a handsaw to amputate a leg? Probably neither of both but I'm not a surgeon so I really can't tell.

  4. #4
    Registered User
    Join Date
    Sep 2007
    Location
    Adelaide, Australia
    Posts
    9
    As someone who switched from C++ to C# years ago and likes to go back and forth between them, here's my main reasons:

    1) .NET (not just C#) provides automatic memory management. This means you don't need to remember to "delete" memory after you've "new'ed" it. The .NET garbage collector keeps an eye on what memory you are using, and can determine the best time to collect the memory as soon as it isn't in use.

    2) It's a common misconception, but .NET code isn't interpreted, but compiled. As a developer, you first compile your DLL's/EXE's into IL, which is like a platform-independent machine code which all .NET languages compile down into. Then, when you run the EXE or load the DLL, it is compiled again (JIT - Just In Time compilation) into machine code and optimized for the processor/system it is running on. The result is that once the application has started, it can be exactly as fast as the equivalent C/C++ application.

    3) .NET is truly type-safe, unlike C and even better than C++. Good examples of this are .NET generics which are a runtime feature, rather than C++ templates which are really "macros on steroids".

    4) .NET has reflection. When .NET code is compiled, metadata associated with the classes contained within the DLL/EXE is provided. This can be used to inspect the contents of DLL's/EXE's at runtime, which provides for some very cool features. Good examples are that it is very easy to create a plugin architecture in .NET.

    5) Unlike C++, if you write C# code, any compiler which claims to be a C# compiler will be able to compile it. This is unlike my experience with C++, whereby every C++ compiler you find seems to be unable to comprehend any C++ code written for any other C++ compiler

    In the end, as GanglyLamb pointed out, it's all about the right tool for the right job. I just wanted to highlight a couple of common misconceptions and features many people fail to notice.

    Cheers,

    Paul

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Great Teacher..
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 03-03-2003, 06:40 AM
  2. Whats so great about Unix?
    By manwhoonlyeats in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 12-23-2002, 09:15 PM
  3. A great C/C++ community
    By Donk in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 06-15-2002, 09:05 PM
  4. What's so great about C++?
    By InFeStEd-ArCh0n in forum C++ Programming
    Replies: 32
    Last Post: 05-07-2002, 10:49 PM
  5. A great community
    By Betazep in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 02-11-2002, 11:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21