Which one to start C++ or C#?

Discussion in 'Programming/Html' started by Mohsin hadi, Apr 22, 2012.

  1. CJ3D

    CJ3D Ancient Guru

    Messages:
    2,388
    Likes Received:
    4
    GPU:
    Asus GTX970 4GB
    Agreed mbk1969, more good points there.

    Another thing I forgot to mentions is there are no header files, I recall spending hours trying to fix annoying header problems in c++. Not fun at all.

    With C# you can basically download source code/projects from the web and compile it with confidence. 95% of downloaded projects just compile and ran (a few projects had fixed file paths pointing to files on the authors PC). You would be lucky to do that with c++ projects.
     
  2. Tat3

    Tat3 Ancient Guru

    Messages:
    11,486
    Likes Received:
    0
    GPU:
    HIS R9 380 4gb
    Why would someone recommend skipping C/C++ and going stright to C#/Java ? Sure it's easier and you get things done faster, but without knowing how things really work. No pointers and addresses ? There are, you just wont see those, same with memory allocation and clearing, you just wont see it.
    Related article: http://www.joelonsoftware.com/articles/fog0000000319.html

    It's good to know how things work on ground level, in the end, somewhere under C#/Java program there is C/C++ code running at some point. C/C++/C++0x will not go away. Also porting C++ application to other platform is likely easier (Embercadero CPP Builder) than porting C# app to multiple platforms.
     
  3. mbk1969

    mbk1969 Ancient Guru

    Messages:
    3,565
    Likes Received:
    8
    GPU:
    GeForce GTX 970
    On ground level is assembler. It is cool and worth to know but absolutely not necessary. Same with C++ - it is necessary for system programming but it is not for education and for application programming. I used to develop on C/C++ since 1991 (and on assembler too). But the last five years on C# are like breath of fresh air, like conversation with a pleasant companion.
    Btw, at those years Pascal was considered as best language for educational purpose.
     
    Last edited: Jan 21, 2015
  4. CJ3D

    CJ3D Ancient Guru

    Messages:
    2,388
    Likes Received:
    4
    GPU:
    Asus GTX970 4GB
    I see your point but c++ is a bit ancient.

    I guess it comes down to what apps you decide on creating.
    For general apps, you dont need to worry about c++ at all, c# is very powerful and hides a lot of the repetitive low level stuff in the background.
    If a DLL you need is in c++, you can simply PInvode the DLL in c# code.

    Think of assembly code, why code in pure machine code when C can do it for you?
    Same with c#. Why code in c++ when c# does it all for you in the background?

    If you plan on developing professional 3D games or performance critical things such as a media codec, you should start with C/C++ or even assembly.

    If you plan on creating general apps (file editors, business apps, utilities), c# is the way to go.
    Most times you don't need to refer back to c++ code, c# has huge support and plenty of libraries available.
    Chances are if the code you need exists in c++, there is a c# or VB.NET alternative available. Just as powerful, less complex, way faster development time, way less lines of code.
     

  5. CJ3D

    CJ3D Ancient Guru

    Messages:
    2,388
    Likes Received:
    4
    GPU:
    Asus GTX970 4GB
    "breath of fresh air"... so true.
    I love programming in c#, clean, powerful, simple, fast.
    I honestly hate programming in c++ now, messy, unsafe, low level repetitive nonsense.
     
  6. mbk1969

    mbk1969 Ancient Guru

    Messages:
    3,565
    Likes Received:
    8
    GPU:
    GeForce GTX 970
    Worth to mention TPL (and concurrent generic collections) and LINQ. When I discovered LINQ it was like revelation. What a cool, powerful feature!
    Also .Net did great job on WMI-related tasks. If anyone compares C++ sources and C# sources which do the same use of the same WMI classes he just will be surprised.
     
  7. Tat3

    Tat3 Ancient Guru

    Messages:
    11,486
    Likes Received:
    0
    GPU:
    HIS R9 380 4gb
    About half year ago at my previous job I was coding C to a microcontroller, that language is old, but definitely has it's place. Good language to start, then go to C++ and then C#/Java. You should see what there is so you appreciate current high level languages and development tools.

    I also like writing C# with Visual Studio, it's not about that. It's just that C/C++ is not going anywhere soon and it's definitely nicer to go to a newer language than to the older one.

    If you take C# at the start... Perhaps it has too much of everything, C would perhaps be more simple to learn and it's not that I recommend coding it 10 years, then 10 years C++ and then to C#. :)
     
  8. Ouzo

    Ouzo Master Guru

    Messages:
    593
    Likes Received:
    0
    GPU:
    MSI 1080Ti Gaming X
    I think it's the productivity, "easiness" part.

    I personally suggest learning C++ in some point, to really understands what it means when someone writes stuff in higher level(more abstracted) programming languages (especially in game programming). C++11/14 would be very good starting point / co-starting point (but C++ is very complex language for beginner, if compared to C#, imho).

    Unity3D (game framework) + C# for absolute beginner would be really nice starting point. It's entertaining, fun, and you keep motivation up, when you constantly see some fun visual things happening when you advance.

    When you have some experience under your belt with those, and still motivated to learn more, maybe be more efficient (code execution vice), you could start investigating C++ ( memory management, pointer arithmetic, passing reference vs value, etc).
     
    Last edited: Jan 28, 2015
  9. A2Razor

    A2Razor Master Guru

    Messages:
    330
    Likes Received:
    0
    GPU:
    ASUS R9 Fury X
    It's an old thread, yet I actually have something to contribute in here.


    There's an inherent problem with hiding pointers & references from the user, far as when someone goes to learn their first programming language and jumps in to .NET or Java. Java and .NET have references to objects, used quite a bit, yet just concealed from the user. .NET for instance, high level objects in an array are treated like references inherently. C++ may seem more complicated, but it has a strong bonus of that references and pointers are all explicitly-defined.


    What I mean by that, is that it's clear to the user what's a copy and what's a reference. Obviously you can learn the cases where it's implied and stop making those mistakes. But ... the novice programmer that's learning it as their first language has no idea. They usually do something like a shallow copy of an array of objects, then modify one of the arrays and later see some confusing behavior that they can't quite explain ... go back, and "Aha!" that was a reference.


    Or, they make a list of objects and find that there's a huge space overhead from pointers internally. But, they have no understanding of the inner workings and what the language is doing because they didn't explicitly do it. It was implied. To me, and it's a personal opinion here mind you. Yet C++ tends to confuse people that I help learn the language alot more than .NET in writing simple software. The end payoff is much better understanding in less time though.


    I'd say the great thing of C++ and C is very low ambiguity compared to higher level languages. It's a different form of complexity.

    ---Concealment may make it look easier, but as soon as the implied behavior isn't what you want... Well, then you're forced to understand it anyway.
     
    Last edited: Dec 10, 2015
  10. nurvitx

    nurvitx Member

    Messages:
    15
    Likes Received:
    0
    GPU:
    Onboard
    I will recommend to start with plain C in the first place. And then with C# or C++. But first things first. Start with C. You need a solid background before anything...
     

  11. Webhiker

    Webhiker Master Guru

    Messages:
    257
    Likes Received:
    1
    GPU:
    EVGA GTX 1080i SC2
    I strongly disagree. You don't need to know how a method is implemented to use it. C# is miles ahead of C / C++ when it comes to ease of use (coding itself). C# is also a lot more structured than C. Sure you can overload methods / classes etc. but still C# code is a lot easier to read IMO. I started with pascal then C++ then went to Delphi and I'm now using C#. So I might be a bit biased. I liked the solid rules of pascal and Delphi and I never got to like C++. So far I'm loving C# and it's high level implementation. The class library is enormous, meaning you have ready to go code for almost any situation.
     
  12. Glidefan

    Glidefan Don Booze Staff Member

    Messages:
    12,329
    Likes Received:
    1
    GPU:
    GTX 1070 | 8600M GS
    Having done C++ in college for a bit, and now using C# in unity, you don't need to have a fundation in C. And when we did C++ in college, no-one required us to do C first.
    In any case, you won't go to the deep end of C# from the get go.
     
  13. A2Razor

    A2Razor Master Guru

    Messages:
    330
    Likes Received:
    0
    GPU:
    ASUS R9 Fury X
    This is a fair point of all languages. Even in C/ C++, a beginner usually doesn't deal with things like pointers and references. I suppose it all depends on the person which they like best for general work.

    To me, I love object oriented design and thus I gravitate to languages like C++, C#, and Java, avoiding raw 'C' (despite that I like to do inline assembly very-often, which I can do in C++ too). That said, I still to this day consider C# more ambiguous than C++ purely due to implied pointers and shallow vs hard copy, or that the 'new' operator has technically two meanings. I just don't like having anything implied.


    EDIT:
    Another thing that shouldn't be forgotten about languages is that some languages have different restrictions / implications. In C# and Java for example with on the fly compiling you don't quite have as much control over what the compiler does, whereas with C / C++ this can be explicitly hinted (such as with inlining or compiler-optimization).

    -But we're not really talking about which language is better for specific things like real-time programming, and this should have no bearing on the language that a person picks for an application without performance or memory constraint.

    For anyone learning programming, my personal advise would be to honestly try several languages. Not only is it fun, but you'll find that once you have a grasp on one language they're all similar (the next language will be far easier to learn).. Broadening your horizons never hurts!


    Also, for people learning ---You are not restricted to using just one language in a project. You can write your entire GUI and main program in C# for instance, then call libraries that you build in C or C++ for where you need speed. Sure, there's complexity in interchangeability between languages, but it can be done, and sometimes it's easier in the end.

    Just something to keep in mind.
     
    Last edited: Jan 17, 2016
  14. Merlena

    Merlena Member

    Messages:
    44
    Likes Received:
    0
    GPU:
    EVGA GTX 980 Ti 6GB SC+
    Splendid written. +1 ^
     
  15. Rontabs

    Rontabs New Member

    Messages:
    4
    Likes Received:
    0
    GPU:
    GTX 850M 4GB
    I'd learn Python
     

  16. vase

    vase Ancient Guru

    Messages:
    1,653
    Likes Received:
    0
    GPU:
    -
    if you want to be able to code a program / app as soon as possible (with soon being a matter of how much time you can invest in the first place) then go for c#.

    if you want to LEARN and UNDERSTAND what you are doing (and what c# is doing ;) in that matter) from a more fundamental perspective and after a little longer time than option 1) be also able to code anything you wish to, while being a little more flexible. then learn c++
     
  17. edma3d

    edma3d Member

    Messages:
    16
    Likes Received:
    0
    GPU:
    Asus Strix GTX 1080
    Learn C++ only if you plan to deal with performance critical apps/games. If you plan to develop general business apps, try C#, it will be more productive.
     
  18. kevinpham02

    kevinpham02 New Member

    Messages:
    4
    Likes Received:
    0
    GPU:
    16
    You should learn .net (c#), it's easy and you can find job easily
     
  19. DroidMan

    DroidMan Member

    Messages:
    18
    Likes Received:
    0
    GPU:
    2Gb
    Personally I think you should learn C#
     

Share This Page