Did I make the mistake of choosing to learn C# over C++?

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 3751 Views - Last Post: 08 August 2011 - 03:03 PM Rate Topic: -----

#1 AVReidy  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 52
  • View blog
  • Posts: 391
  • Joined: 17-February 11

Did I make the mistake of choosing to learn C# over C++?

Posted 05 August 2011 - 08:56 PM

Coming from more of a Java background, C# seems incredibly familiar. I'm confused on what the language is for, though. From what I've read, it was made to be an easy object-oriented language for quickly making GUI applications and perhaps small games. I'm very new to .NET and all, but from what I've heard, C# is apparently less portable than C++ and C because of its dependence on the .NET framework.

I would like to hear your definitions of what C# is, and what is it used for in business. Also, why are most graphic-intensive games written in C/C++? What are the advantages of those? I don't understand how having to take care of memory usage helps games run faster.

Help me understand what C# is for!

Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Did I make the mistake of choosing to learn C# over C++?

#2 Momerath  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 809
  • View blog
  • Posts: 1,949
  • Joined: 04-October 09

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 05 August 2011 - 10:07 PM

http://en.wikipedia....ing_language%29
Was This Post Helpful? 0
  • +
  • -

#3 Jeff H  Icon User is offline

  • D.I.C Regular

Reputation: 111
  • View blog
  • Posts: 301
  • Joined: 30-January 11

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 05 August 2011 - 10:56 PM

Doesn't Java have a some kind of Runtime mechanism?

C# is .NET complaint language supported by Microsoft.

People might have different concepts of what it is but maybe you can think of it as a vehicle to a software platform to make leasieriser such as

  • Interoperability with existing code
  • Supports multiple languages including C#
  • A common runtime engine shared by all .NET languages
  • Complete language integration
  • Comprehensive base library
  • Simple deployment model



For example a simple set of instructions to add 2 and 6
C#
            int x = 2;
            int y = 4;
            int total = x + y;  and VB



and VB

   
        Dim x As Integer = 2
        Dim y As Integer = 6
        Dim total As Integer = x + y



They are compiled into IL(intermediate language) that CLR will run and handle

So we could go deeper and write it like this

Quote

ldc.i4.2 //Load Constant int32 2
//--- Push 2 on stack as int32
stloc.0 //Store into local Variable 0
//--- Pop value from stack into local variable 0
ldc.i4.4 //Load Constant int32 4
//--- Push 4 on stack as int32
stloc.1 //Store into local Variable 1
//--- Pop value from stack into local variable 1
ldloc.0 //Load local varaible 0 onto evaluation stack
//--- Load local variabvariableo stack
ldloc.1 //Load local varaible 1 onto evaluation stack
//--- Load local variable 1 onto stack
add
//--- Add
stloc.2 //Store into local Variable 2
//--- Pop value from stack ivariablel variable 2
ldloc.2 //Load local varaible 2 onto evaluation stack
//--- Load local variable 2 onto stack



another level deeper to (and in C# you can not create global variables but you can in CIL)

Quote

0x18 //ldc.i4.2
0x0A //stloc.0
0x1A //ldc.i4.4
0x0B //stloc.1
0x06 //ldloc.0
0x07 //ldloc.1
0x58 //add
0x0C //stloc.2
0x08 //ldloc.2


So your VB.Nofficially# or whatever gets compiled to CIL or MIL or IL(I think it is offically called CIL)
That your Jit's compile down to machine code.

Yes with C# is less portable but you can build desktop, deasilye, web, game and many other applications and work with each of Floridaisly with one technology.

I do nexperiencedout your area but here in Flordia 4 out 5 jobs posted are wanting expirecend .NET, ASP.NET, SQL Server developers.

Did you make a mistake?
I would say yes that you should also learn C++
If you choose C++ I would say you made a mistake and should learn C#.

So I think you making a mistake thinking you might be making a mistake.
It is not learning C# but learning the framework that is valuable.
If you learned C++ and VB.NET you would pick up C# in a weekend due to knowledge of the framework from VB.

It boils down to 1's and 0's and programming languages just give you another way express it.
Was This Post Helpful? 2
  • +
  • -

#4 tlhIn`toq  Icon User is offline

  • Closing in on 5,000
  • member icon

Reputation: 4928
  • View blog
  • Posts: 10,465
  • Joined: 02-June 10

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 06 August 2011 - 06:06 AM

View PostAVReidy, on 05 August 2011 - 09:56 PM, said:

Help me understand what C# is for!


Its for writing programs.

Now whether it is the best choice for your programs, for your needs, for your application...
Nobody here can say.

It has served us well for years. We make applications that take/display/sell photos for amusement parks. Ya, know when you go down a roller coaster, then see your photo on a big display wall, then buy it at the counter... That's us.

All the consumer programs that come from Canon on the CD when you buy a DSLR are written in C#.

I've seen MANY POS/kiosk applications that were C#.

Quote

from what I've heard, C# is apparently less portable than C++ and C because of its dependence on the .NET framework.


If your need is to write mobile applications for cell phones, then C# is not the choice.

But if your need is to write desktop/server/workstation applications on Windows... Then C# should serve you well.
Was This Post Helpful? 2
  • +
  • -

#5 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1211
  • View blog
  • Posts: 4,126
  • Joined: 27-January 10

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 06 August 2011 - 06:22 AM

Quote

I would like to hear your definitions of what C# is, and what is it used for in business.


It all depends on what your local job market is like. Here in Bolivia, where I live, if the job requires the application to run on Windows 19 times out of 20 the employers want it in .NET.

Currently I'm trying to push the envelope for ASP.Net MVC3. Most shops here just use Webforms, but for my projects I use MVC3 in hopes that it'll catch on.

.NET is a FULL stack. It's gigantic. It'll take YEARS before you can become a master.

With .NET (and you can use C#), you can make:

Windows Phone 7 apps.
Desktop applications.
Rich internet application (Silverlight)
Server applications.
Services for other applications to use.

Do you see how enormous it is?

I think this questions is kind of flaimbait to be quite honest.
Was This Post Helpful? 0
  • +
  • -

#6 assiance  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 7
  • Joined: 23-October 08

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 06 August 2011 - 01:52 PM

I just graduated college with a B.S degree in computer science. We mainly learned c++ and from what I can tell the job market is full of java and .net dev. positions.

If I didn't take the time out to learn C# on my own while I was in school, I probably would of had to move a great distance to find a job. I think I saw maybe one c++ dev. position out of about 30 jobs.

In my opinion, if you learn C#, you pretty much know the basics of C++.
Was This Post Helpful? 1
  • +
  • -

#7 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1211
  • View blog
  • Posts: 4,126
  • Joined: 27-January 10

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 06 August 2011 - 02:12 PM

I disagree. I've never programmed in C++, if I were to switch TODAY, it would take me some time to get used to pointer, memory management and all sorts of intricacies the .NET framework handles for me.
Was This Post Helpful? 1
  • +
  • -

#8 Mikhail  Icon User is offline

  • Bastard Operator From Hell
  • member icon

Reputation: 53
  • View blog
  • Posts: 1,369
  • Joined: 26-October 07

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 06 August 2011 - 02:19 PM

No you're not making a mistake here, C# is a great language to know, I live in Chicago and most of the jobs you come across will C# or Java maybe 8/10 jobs will either be C# or Java, like assiance said if you know C# you know basics of C++, if you know C# you will quickly get a grasp with Java, both languages are identical with their own differences.

What you learn when learning a language is the syntax rules for it, logic is the same everywhere, just with a different way of writing it.

So do learn C#, I was stubborn a few years ago, and I thought C++ was everything, and as soon as I started learning C# + .Net I realized it's not just any language, it a giant framework where anything is possible, possibilities are endless.

My recommendation is to learn C# + .Net and if you need to you will easily learn any other language you need to know such as C/C++, Java, and many others.
Was This Post Helpful? 1
  • +
  • -

#9 Momerath  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 809
  • View blog
  • Posts: 1,949
  • Joined: 04-October 09

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 06 August 2011 - 02:31 PM

View PosttlhIn`toq, on 06 August 2011 - 06:06 AM, said:

If your need is to write mobile applications for cell phones, then C# is not the choice.


You can write mobile applications for cell phones for Windows 7, Android, and iOS based phones in C#. See MonoDroid

This post has been edited by Momerath: 06 August 2011 - 02:32 PM

Was This Post Helpful? 1
  • +
  • -

#10 tlhIn`toq  Icon User is offline

  • Closing in on 5,000
  • member icon

Reputation: 4928
  • View blog
  • Posts: 10,465
  • Joined: 02-June 10

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 06 August 2011 - 03:02 PM

View PostMomerath, on 06 August 2011 - 03:31 PM, said:

View PosttlhIn`toq, on 06 August 2011 - 06:06 AM, said:

If your need is to write mobile applications for cell phones, then C# is not the choice.


You can write mobile applications for cell phones for Windows 7,

I guess I barely consider that writing for a phone. Its more like writing for Windows with a very limited screen size. Kinda like writing for a WindowsCE based PDA. Which is not meant to diminish what WinPhone7 developers do. Its rather nice to be able to take years of learning and apply it to a different device rather than start over. Personally I'm an iPhone fan so I probably won't be doing anything with WinPhone7 any time soon, though I would like to dabble with it in my free time: Which is scheduled for May 2024 given my current work load.

Quote

and iOS based phones in C#. See MonoDroid


That's not writing for iOS. For iPhone and iPad you write it objective-C.
Mono is shoe-horning .NET into a device that really wasn't meant for it.
Kinda like going grocery shopping in an 18 wheeler. It gets the job done, but its not the right way to do it.
Was This Post Helpful? 0
  • +
  • -

#11 Curtis Rutland  Icon User is online

  • (╯°□°)╯︵ (~ .o.)~
  • member icon


Reputation: 3798
  • View blog
  • Posts: 6,405
  • Joined: 08-June 10

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 06 August 2011 - 06:52 PM

Quote

Its more like writing for Windows with a very limited screen size. Kinda like writing for a WindowsCE based PDA.


Not really anymore. It used to be for WinMo, but for WinPhone7 it's a lot more like developing for silverlight (well, it is silverlight).

And there's MonoTouch for iOS development. There have been a few good apps produced with it that I know of. It's not really shoehorning, I believe it emits an actual iOS executable, it just uses a different language to create it.
Was This Post Helpful? 0
  • +
  • -

#12 The Architect 2.0  Icon User is offline

  • D.I.C Regular

Reputation: 37
  • View blog
  • Posts: 351
  • Joined: 22-May 08

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 06 August 2011 - 10:59 PM

View Postassiance, on 06 August 2011 - 02:52 PM, said:

In my opinion, if you learn C#, you pretty much know the basics of C++.


i INCREDIBLY disagree with that statement. if you know c#, you know the principles of OOP. you don't know jack about pointers or generic programming which is critical for c++(among a million other things).
Was This Post Helpful? 0
  • +
  • -

#13 Curtis Rutland  Icon User is online

  • (╯°□°)╯︵ (~ .o.)~
  • member icon


Reputation: 3798
  • View blog
  • Posts: 6,405
  • Joined: 08-June 10

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 06 August 2011 - 11:19 PM

Well, you should know about the concept of reference types (which are automatic for classes in C#), and you certainly can learn about generic programming with C#, since it fully supports generic. But I do agree that C# doesn't teach you much about C++, since C++ is significantly lower level. You need to know about pointers and templates and their crazy classes and such. It's definitely different. C++ feels like it's "bolted on" if you know C (which I really don't), in C# everything feels very integrated.
Was This Post Helpful? 0
  • +
  • -

#14 Mikhail  Icon User is offline

  • Bastard Operator From Hell
  • member icon

Reputation: 53
  • View blog
  • Posts: 1,369
  • Joined: 26-October 07

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 07 August 2011 - 12:47 AM

View PostThe Architect 2.0, on 07 August 2011 - 12:59 AM, said:

View Postassiance, on 06 August 2011 - 02:52 PM, said:

In my opinion, if you learn C#, you pretty much know the basics of C++.


i INCREDIBLY disagree with that statement. if you know c#, you know the principles of OOP. you don't know jack about pointers or generic programming which is critical for c++(among a million other things).


You are correct about this yes, however If you know C#, it will be much more easier for you to learn C++, due to already having a solid or even working foundation of how OOP programming works, which will make it much more easier to learn C++, than it is without having any foundation whatsoever.

However everyone has their own learning style, for some people it may be easier to learn C++ or even C before going on for C#, or even I know of some people who have went with Java and upgraded from there.
Was This Post Helpful? 0
  • +
  • -

#15 The Architect 2.0  Icon User is offline

  • D.I.C Regular

Reputation: 37
  • View blog
  • Posts: 351
  • Joined: 22-May 08

Re: Did I make the mistake of choosing to learn C# over C++?

Posted 07 August 2011 - 08:48 PM

yep, of course knowing C# will help in learning another language. However, I consider pointers to be a basic part of c++ and you will not learn how to use pointers effectively in c#(especially if you never get to cross-reference c++ when learning c#).
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2