Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What advantages can I get from learning C++ if I'm mainly a C# Programmer? [closed]

Tags:

c++

c#

Recently I've started to notice a lot of smirks and generally rude comments whenever I mention C#. Everyone I talk to either says learn Python or learn C++.

Python is a nice language, I get it. But I don't find much use for it right now (for my use cases), and C++ I heard is a faster language (not sure).

So my question is this, what advantage can I get from learning C++ (besides the knowledge and expansion of my horizons), when I mainly program in C#?

like image 574
Sergio Tapia Avatar asked Oct 01 '09 00:10

Sergio Tapia


People also ask

Is there any benefit in learning C?

By learning C, you will be able to understand and visualise the inner workings of computer systems (like allocation and memory management), their architecture and the overall concepts that drive programming. As a programming language, C also allows you to write more complex and comprehensive programs.

Is C or C+ Better?

C is still in use because it is slightly faster and smaller than C++. For most people, C++ is the better choice. It has more features and more applications, which allow you to explore various roles. For most people, learning C++ is also easier especially if you are familiar with object-oriented programming.

What is the basic advantage of C?

C is a middle-level programming language that means it supports high-level programming as well as low-level programming. It supports the use of kernels and drivers in low-level programming and also supports system software applications in the high-level programming language.

Why is C the best choice?

The idea that C is the best answer to choose when guess-answering a question on a multiple choice test rests on the premise that ACT answer choices are not truly randomized. In other words, the implication is that answer choice C is correct more often than any other answer choice.


2 Answers

The biggest issues are as follows:

  • C++ is the de facto standard of system AND application programming for the past 20 years
  • C++ is portable and compilers exist for ~ 95% of all processor architectures.
  • C++ can enhance your .NET code, by that I mean PInvoke can be done to run optimized code written in C++ -OR- can be used to run code from 3rd parties, allowing you to write custom wrappers etc.
  • C++ is linux/mac/PSP/Cray II/Random OS from Thailand compliant, it has no issue compiling because it doesn't run through the .NET CLI (which I have to admit is a beautiful piece of art) C# is bound, for now, to Mono implementations and Windows through .NET.

As a professional .NET applications programmer, I love C#, I worship the ground that the architects walked on. But C++ is in my opinion, the most important language you can/will ever learn because it will open more career doors than any other language in the modern industry. If you know C# it will take you a matter of months to learn it. I reccommend Timothy D'Orazi's C++ book if you have an academic software engineering background.

Afterthought: C++ is a tool, just like C# or a drill or a shotgun (arguably) fit the tool to the task, I'd rather die than write functional code in C++, likewise, I wouldn't do application development in F#, they're all fine langauges. Learn something that interests you! If you want to be a better programmer, learn C++, if you want to be a better application developer, it may be more to your advantage to learn new technologies within the framework you're already working in! You are a C# programmer, have you learned WPF? WCF? what about the features of C# 4.0? Have you mastered lambda functions? expression trees? There are so many directions you can go from here, C++ is just one of them. Ask yourself the following questions:

  • What can I learn that will add value to me?
  • What can I learn that will interest me as a developer?
  • What can I learn that will benefit me in my immediate position?
  • What can I learn that will help me get into the kind of career path that I want to be in?

You'll find that there will be many answers that overlap for these questions, take your time, find something that interests you and won't be a chore to learn, you'll thank yourself for it 3 months from now.

like image 116
Firoso Avatar answered Sep 26 '22 05:09

Firoso


Short answer: Learning at least some C++ (and some assembly language too) makes you better at leveraging and, perhaps more importantly, debugging the software platform deep underneath your code. This is true regardless of the programming language or OS you're working in.

Long answer:

One of the differentiating factors, IMHO, between good developers and great developers is that the great ones know what's going on under the hood in a piece of software and are capable of quickly drilling down underneath layers of abstraction in the technology stack, since the toughest software problems are often caused by things way down below your code in the stack.

Therefore, I've always recommended that developers, at some point in their careers, spend at least some time learning two languages which are at the bottom of almost every software stack: C/C++ and x86 assembly language. That doesn't mean you need to become an expert in either, but having a working knowledge of things like pointers, registers, memory management, stacks and heaps, un-GC-ed string buffers, leaks, etc. is hugely useful when you need to reach down into the stack to diagnose a problem, to better understand odd behavior, or simply to make smarter decisions as you architect higher-level software, regardless of the language.

An analogy: I became a much better manual transmission driver once I took apart my motorcycle's engine and saw how the clutch worked. That didn't mean I needed to become a motorcycle mechanic, only that it helped my overall driving skills once what was happening inside my bike was not a mystery anymore.

Also, regardless of the language or framework you're working with, for projects that must call directly down into the underlying platform, C/C++ knowledge is very helpful and sometimes required.

Note that I'm deliberately not touching the more contentious question about whether you should be writing entire apps in C++ or not. Other answers have done a great job covering those arguments. Instead, I'm simply making the case that C++ skills will benefit you, regardless of whether you continue writing most of your code in C# (or Java or Python or Ruby or...)

like image 30
Justin Grant Avatar answered Sep 22 '22 05:09

Justin Grant