Fog Creek Software
Discussion Board




relationship between c, c++ and c#

I have spent the last 3 years as a project manager in an e-learning company and wish to broaden my experience/marketing with programming skills.  I am fluent in db and .asp programming, as well as using Actionscript. 

What I would like to do is to learn some of the more robust languages.  In many other posts in this forum, advice to learning languages (and becoming a good programmer) usually follows this path: Assembly language, then C, then brancing into either C++ or C# or Java.

Given that it would take a while to learn all of these, could a person start with C# and not miss something of importance that the older languages might provide?

There are 2 objectives I have in learning a language.  The 1st is a broader experience in order to get a new job as a programmer.  The 2nd is curiosity.

Frogmoses
Thursday, April 22, 2004

"In many other posts in this forum, advice to learning languages (and becoming a good programmer) usually follows this path: Assembly language, then C, then brancing into either C++ or C# or Java."

I'm not convinced that this is the case, especially starting with Assembly. That would be completely inappropriate, imho.

Really, it depends on what field you want to work in, e.g. games, web apps, windows apps, *nix, etc.

Steve Jones (UK)
Thursday, April 22, 2004

I am with Steve on this one.  Assembly is a great language if you want/need to know how the machine really deals with a structure in C or you are working "against the metal".  Otherwise, "run away...run away." ;)

Some people believe that you should learn C before C++.  I did, but I cannot say that it would have hurt to learn C++ first.  In fact, I have an associate who is of the opinion that C first makes the jump to OO languages harder. (Having done it, I cannot really say - but I see her point)

As for going straight into C#?  Sure, you have to start somewhere.  I personally would start with Java, but I that is just a personal thing as I see C# in the Java context.  In addition, _today_ there is a larger body of work in Java.

MSHack
Thursday, April 22, 2004

I believe that what is important is that you aquire a good mental virtual machine model. The advantage of an assembler like learning environment is that it is extremely simple and well closed (in Joelspeak not too leaky). It presents a good mental model on "how computers really work". It serves as a foundation on which to build higher abstractions: The C machine, the C# machine etc. These will be more and more "leaky", but you'll be fine, since you will leak through too a foundation you understand (I'm putting this in language terms, but the same things hold for things like OS'es and API's).
In theory you can start with a higher level abstraction, but you might have more problems. As mentioned before, when eventualy you fall into a crack in the pavement, there is no lifepreserver. Additioinally, since there are many different higher level abstractions (Lisp, Smalltalk, .NET, Java, SQL, ...), you might have problems unifying them, e.g. when you want to learn a new one.
Going the "bottom up" road you can ground everything you learn into a common reference framework.

Just me (Sir to you)
Thursday, April 22, 2004

If you were learning to drive, would you go off and drive a 1940's racing car at 100mph to start with, or would you get a nice supermini and pootle round quiet roads at 20mph for a while?

You do not need to learn C before C++, you do not need to learn assembly before C. Chances are it'll actually make things worse, 'cos you'll first have to unlearn a load of things you've already learnt.

If you want to learn programming start with a language that helps you - like C#. If you want to learn a specific language learn that language and no other.

Mr Jack
Thursday, April 22, 2004

"If you were learning to drive, would you go off and drive a 1940's racing car at 100mph to start with, or would you get a nice supermini and pootle round quiet roads at 20mph for a while?"

To use a different car analogy, a lot of people do advocate learning to drive in a "standard" (aka "manual"), and then upgrading to an automatic once you're fully confident -- the belief is that being "in touch" with the engine/road process early on imbues skills that are beneficial in any car, while someone who starts in an automatic will forever be without this knowledge.

Dennis Forbes
Thursday, April 22, 2004

Learn C# directly. After this, learn, in this order:

1. how to use the library (ASP .NET, WinForms, ADO .NET) properly

2. OOD design, design patterns and analysis

3. algorithms and data structures

Knowing these 3 things will make you a lot better as a programmer than someone who knows assembler, C and C++, but doesn't know the 3 things above.

I'm not saying that ASM and C and C++ are worthless. On the contrary, they are worth learning.

But this is a matter of priority and choosing where to spend your learning time and effort.

Learn the 3 subjects I indicated above!

Jay
Thursday, April 22, 2004

"To use a different car analogy, a lot of people do advocate learning to drive in a "standard" (aka "manual"), and then upgrading to an automatic once you're fully confident -- the belief is that being "in touch" with the engine/road process early on imbues skills that are beneficial in any car, while someone who starts in an automatic will forever be without this knowledge."

Hey! This is like the proverbs game!

Mr Jack
Thursday, April 22, 2004

I'm a skilled driver. I drove both automatic and manual shift cars.

I don't think driving a "standard" car is such a learning experience.

However, learning to apply emergency breaks yourself, learning to turn the wheel in the direction of the skid, etc - are very valuable experiences.

Makron
Thursday, April 22, 2004

I do not think anybody would suggest starting out by doing complex apps in ASM and then complex apps in C before doing complex apps in C#.
The idea is to learn different things at different levels. At the ASM level learn about processing instructions and memory, simple data representations and control structures. Basic interrupt stuff.
At the C level look into more complex data structures, complex pointer handeling, memory management, garbage collection, basic Windows API stuff, messagepumps etc.
Then at the C# level attack OO, whole applications, large API's etc.

The whole car analogy stinks because it is wrong in assuming the complete task (driving) is always the same, and because given the task required and within normal operational limits the "abstractions" are very much less leaky.

Just me (Sir to you)
Thursday, April 22, 2004

If you think about it, a lot of people have learned these languages in a different order, so in the long run I doubt it makes that much difference.

I also don't subscribe to the "don't learn C first because you'll develop bad habits that you'll have to unlearn" philosophy.  Sure, if you programmed exclusively in C for a couple of years that might be true, but if you're learning C just for the sake of understanding the fundamentals then moving on I doubt that would be the case.

anon
Thursday, April 22, 2004

I appreciate all the advice.  Jay, I think your approach is very valid. 

There seem to be 2 forces at play in my decision.  The one is to become a good programmer, ie., one who understands and practices the fundamentals of good programming.  The other force is to have a skill in the near future.  I am leary of spending the time, starting with ASM and progressing through the other languages, to find out I could have reached this point if I had started with C# with an eye towards the larger goal.

These are not contradictory forces.  I believe one can learn good programming while learning the structure and syntax of a single language.  My concern is this: by concentrating on a single language, such as C#, would I be missing fundamental programming knowledge that would hinder future development as a programmer.

Frogmoses
Thursday, April 22, 2004

Learning C# or Java by first learning Asssembly language, then C followed by C++ is just crazy. If you want to become a really good Java programmer then focus on Java, unless time and money is of no concern to you.

Another problem is that all of these languages belong to a different paradigm, so learning them all will not just be learning different programming languages, it means learning totally different way of thinking when programming.

Assembly - machine language
C - structured programming language
C++ - object oriented language
C#/Java - managed (garbage collector) language

I started as a C programmer. It took me long time after learning to program using C++ to actually understand how to write object oriented programs. I am now in the process of learning C# and I can see the benefits of the garbage collector, but I know it will take many more months before I will really get it and can take full advantage of it when designing applications.

Mellowman
Thursday, April 22, 2004

Whatever your choice, remember that finding the best docs is most vital.  More so than language choice.  Book popularity is really no indicator and it is worth your time to look and ask around.

Python should be on your radar.  Advantages are an interactive environment, timely documentation, power, easily installable, disturbingly cheery and helpful community.  I think it's worthwhile to look at for a session, perhaps as a short break from say C#.

Tayssir John Gabbour
Thursday, April 22, 2004

I firmly believe that understanding Assembly is very important for a programmer.  It doesn't matter whether you know all the details of a particular chip's instruction set, what matters is that you use Assembly as a way to gain understanding of how the computer does things.

That said, I don't see it really mattering whether you learn Assembly first or pick it up later.  Just as long as you DO pick it up at some point.

MikeMcNertney
Thursday, April 22, 2004

Learning programming by C, C++ and C#? This is trying to prepare healthy lunches by alternating between grape, strawberry and raspberry on your peanut-butter and jelly sandwiches.

It can be done, but the major trap that people fall into is applying the first style they learn to everything that follows. It's easy to write assembly-style programs in C, Java, or C++, but that doesn't mean you've learned the latter languages.

So when you move from C to Java, you keep in mind that you haven't learned Java until you are good at solving problems by object modeling instead of just writing procedures. Otherwise you'll be stuck writing C in Java.

If you move from Java to C++, you need to make sure you get a handle on templates and the STL, or you'll just be writing Java in C++.

Branch out, get some variety. Try something functional like Scheme or Haskell, Try something declarative like SQL or Prolog. Try something array-oriented like Matlab or K.

Ham Fisted
Thursday, April 22, 2004

I've taken several classes using assembler, and its an awesome language for learning how everything works (memory, encryption, etc) at the lowest level.  As for the C and C++, I'd say to just go toward c++ first, i've learned both and i'd say c++ will teach you way more in the long run.  At the same time, i have yet to find an employer who gives a shit about assembler (I'd love to program in assembler though for a job, its more enjoyable for me than Object Oriented or web based languages).  If anyone is  looking for someone who has likes programming in assembler, I'm definitly interested----shameless job seeking conclusinon.

grover
Thursday, April 22, 2004

apparently truck driving schools prefer their students to have no previous manual transmission experience--they don't have to unlearn all the bad habits.

but for the particular question, go with C# if that's what you want. go with C or assembly (68k) if you care about low-level stuff. go with Scheme or Prolog if you want to twist your mind.

mb
Thursday, April 22, 2004

*  Recent Topics

*  Fog Creek Home