Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


C First?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • This topic is locked This topic is locked
49 replies to this topic

#1 Serapth   Crossbones+   -  Reputation: 5792

Like
0Likes
Like

Posted 07 February 2012 - 01:39 PM

I have noticed as a rather recurring trend that quite a few people seem to recommend learning C before learning C++.

When I was starting out, the option was basically taken from me ( C++ was fairly new and compilers were scarce ), so I never had to make this decision. I have my own opinion on the subject now, but I don't want to taint the thread with it. So I was hoping to do a quick survey.




Questions:

Do you recommend a new developer learn C before C++?
What skill level would you consider yourself in C++ today?
Why? ( either way EDIT: Why as in do you recommend for/against C++ first, now why do you consider yourself a certain skill level. ;) )

Sponsor:

#2 Serapth   Crossbones+   -  Reputation: 5792

Like
2Likes
Like

Posted 07 February 2012 - 01:47 PM

My personal thoughts on the subject.

Learning C first is bad, very bad. At this stage in the game, C and C++ are completely different languages and should be treated as such. I can personally see very little to no real advantage of learning C first, except perhaps as a erudite pursuit. That there are C underpinnings to C++ that are there for legacy reasons only, not learning C first removes the user from exposure to this "cruft". I don't really think that knowing 100% of a language, especially deprecated aspects, makes you a better C++ programmer.


I would consider myself a pretty piss poor C++ programmer, but I do have 15+ years exposure to the language, while only 2 of those in professional use.

#3 Antheus   Members   -  Reputation: 2397

Like
-7Likes
Like

Posted 07 February 2012 - 02:04 PM

Do you recommend a new developer learn C before C++?

Depends.

What skill level would you consider yourself in C++ today?

Yes.

Why?

Yes.

#4 6510   Members   -  Reputation: 151

Like
0Likes
Like

Posted 07 February 2012 - 02:06 PM

Waste of time.
You will need all your time and more to get into that C++ zombie.

#5 kunos   Crossbones+   -  Reputation: 2207

Like
0Likes
Like

Posted 07 February 2012 - 02:14 PM

i think for a complete noob.. C can offer an easier way in, it's a smaller simpler language. At the very beginning of programming I think the guy is already confused by the very idea of variable, control flow and function calling.. no need to get more confused with OOP stuff. For the very first steps a language such as standard basic or pascal migh also do.
Having said that, the danger is to fall into the trap of things like "ah ok, I get C++ now, you use cout instead of printf and class instead of struct".. which is exactly what I did when I was trying to transition to C++ with a background in old basic and C. It's funny that I really understood C++ when I started to study Java.. there you are forced to go OOP or die.

I don't have an answer.. programming is hard and to get good at it you need to WANT IT .. languages perhaps don't really matter.. commitment does. any serious programmer should and will end up knowing at least 3-4 languages from average to good.
Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#6 ApochPiQ   Moderators   -  Reputation: 16414

Like
0Likes
Like

Posted 07 February 2012 - 02:28 PM

One should learn the language most suited to the task they wish to accomplish.

95% of the time, that means neither C nor C++.

#7 Washu   Senior Moderators   -  Reputation: 5593

Like
2Likes
Like

Posted 07 February 2012 - 02:35 PM

One should learn the language most suited to the task they wish to accomplish.

95% of the time, that means neither C nor C++.

Indeed. 95% of the time you should learn...
HASKELL

On a more serious note:
C and C++ share some history. That's about it right now. There has been some standing movement in the C and C++ world to bring the two languages closer together, however that's all it really is...

From a learning perspective starting out with C vs C++ does not give you any particular advantage. Both languages have the same pitfalls in the same areas, although C++ also has other areas with other pitfalls that you must avoid. The thing is, from a learning perspective you're not likely to hit those "more advanced" pitfalls until you actually GET to those C++ features.

If you're hellbent on learning C++, learn C++. Don't learn C. Someone else actually put that better..

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.
ScapeCode - Blog | SlimDX


#8 Serapth   Crossbones+   -  Reputation: 5792

Like
1Likes
Like

Posted 07 February 2012 - 04:08 PM

Do you recommend a new developer learn C before C++?

Depends.

What skill level would you consider yourself in C++ today?

Yes.

Why?

Yes.


Very informative, but I have to disagree with you on that last part there.

#9 mhagain   Crossbones+   -  Reputation: 8284

Like
0Likes
Like

Posted 07 February 2012 - 06:23 PM

There's really no advantage to learning C first. If you don't want to go head-first into OOP, a much better option is to restrict yourself to the C-like subset of C++. You'll get a much nicer language to use with more modern thought behind it and you'll also have all the C++ extras to play with for times when they may come in useful.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#10 Servant of the Lord   Crossbones+   -  Reputation: 21185

Like
1Likes
Like

Posted 07 February 2012 - 06:37 PM

Do you recommend a new developer learn C before C++?

Definitely not. It'd hamper your ability to understand C++, not enhance it.

What skill level would you consider yourself in C++ today?

Decent. Not an expert, but not a novice either.

Why don't you recommend C++ first?

Because C++ is not C. It is a different language that is backward compatible with C. That was 15 years ago.
Now it's even more different. Still backwards compatible, but very different.
The fundamental difference is not new features, or different keywords, but different ways to think. If you start with C, you'll learn to think in a different way from that which C++ is trying to teach you.

But you're in luck! C++ just changed again. The new C++11 standard version of the language makes (or is in the process of making) C++ more modern, cleaner, faster, and easier to learn then ever. In may be difficult, since C++ is in transition from the "old" C++ to the "new" C++, and there's a lack of resources, but soon good tutorials and books will be coming out that teach the refined and enhanced C++ for beginners.

That said, it may be better to start with a language like Python. But if your choice is between C and C++, it's not even a choice that needs to be seriously considered... Go C++.

My suggestion would be: Learn Python and stick with it for several years, and after that learn C++. Learning Python _will_ help you learn C++, while also giving you skills in Python that are valuable in themselves. Learning C will help some, and hinder some, and the skills wont really be valuable in their own right, unless you are working in some very specific circumstances.
What I mean is, if you know C++ and Python, you'll find circumstances to use both even when you know both. If you know C++ and C, you'll only find circumstances to use C++ except in very rare scenarios.
It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal

[Fly with me on Twitter] [Google+] [My broken website]

[Need web hosting? I personally like A Small Orange]


#11 AllEightUp   Moderators   -  Reputation: 4272

Like
0Likes
Like

Posted 07 February 2012 - 08:45 PM

I have noticed as a rather recurring trend that quite a few people seem to recommend learning C before learning C++.

When I was starting out, the option was basically taken from me ( C++ was fairly new and compilers were scarce ), so I never had to make this decision. I have my own opinion on the subject now, but I don't want to taint the thread with it. So I was hoping to do a quick survey.


Questions:

Do you recommend a new developer learn C before C++?
What skill level would you consider yourself in C++ today?
Why? ( either way EDIT: Why as in do you recommend for/against C++ first, now why do you consider yourself a certain skill level. ;) )


I will go against many folks and say that I agree with learning C first but with a couple differences. First off, learn "C" in the context of "C++". I.e. use cpp/cxx files so the compiler assumes C++ and use the syntactic sugar which C++ allows such as creation of variables as needed instead of all defined at the head of the function. There is no effective difference in the generated code and in this specific example, C++ can actually be more efficient since it won't expand the stack until needed and may keep core variables in cache longer due to the "expand only as used" behavior. (Not all compilers respect this as it can be a detriment, depends on the function and the compiler's belief of which is better. Key item here, trust your compiler until it proves to be wrong....)

The second reason I suggest the above is the primary item I have to explain to new programmers multiple times. "Pointers" and how they work. Pointers are so simple yet the language makes them complicated for various reasons. How can uint8_t* ++ =1, uint16**++=2 etc and how struct/class*++ doesn't match anything you might expect. How can temp[ 80 ] be used the same way as generic pointer math or temp[ 80][ 80] etc. Pointer math is rather arcane and the only thing I really care folks learn before digging into other areas is that they have a VERY solid pointer math understanding as it is critical to a lot of higher level usage of the language.

Finally, solid understanding of the language. I don't think ANYONE should code OO, virtuals, templates, etc until they REALLY understand the general base language of 80ish keywords.

As to the alternative ways to learn programming in general, sure fine whatever. Learn Python, Java, whatever, but to make the jump to C++, is a very large change and as the Spidey paraphrase goes: "With power comes responsibility". It is your responsibility to learn the basics before jumping into the fancy stuff because you can so easily screw things up.

#12 Tachikoma   Members   -  Reputation: 552

Like
0Likes
Like

Posted 07 February 2012 - 08:58 PM

Depends what platform you want to break into.

Personally I say learning C first is very useful. It exposes you to some fundamental programming concepts and gives you an insight how machines work one level up from assembly. Also, many laguages "borrow" the C syntax in various forms, and some laguages is even a superset of the C standard. Objective-C is one such example.
Latest project: Sideways Racing on the iPad

#13 Cornstalks   Crossbones+   -  Reputation: 6991

Like
0Likes
Like

Posted 07 February 2012 - 09:27 PM

First off, learn "C" in the context of "C++".

But... why???

The second reason I suggest the above is the primary item I have to explain to new programmers multiple times.

Yeah, because you can't use pointers in C++... or maybe it's because pointers are different in C++...

Finally, solid understanding of the language. I don't think ANYONE should code OO, virtuals, templates, etc until they REALLY understand the general base language of 80ish keywords.

But... why???

Personally I say learning C first is very useful. It exposes you to some fundamental programming concepts and gives you an insight how machines work one level up from assembly.

Learning C can be useful, yes, but that doesn't mean it should be learned before C++ (nor does it mean C++ should be learned before C).

Also, many laguages "borrow" the C syntax in various forms, and some laguages is even a superset of the C standard. Objective-C is one such example.

Learning C just for the syntax is unnecessary. The syntax is such a small part of programming.


@OP: If there's a language you want to learn, learn it. C is a totally different language from C++. If you want to learn C++, learn C++. If you want to learn C, learn C. If you want to learn Haskell, learn Haskell. etc.
[ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

#14 daviangel   Members   -  Reputation: 600

Like
0Likes
Like

Posted 07 February 2012 - 11:19 PM

Objective-C is one such example.

Yeah the hell with it let's just have everyone just start out with Objective-C Posted Image
then they'll have no clue if they are learning C or C++ or some bastard hybrid like most people that start out learning C code continue to write even when they finally switch to C++ since they never really get the C++ thing Posted Image
Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe

#15 Tachikoma   Members   -  Reputation: 552

Like
0Likes
Like

Posted 07 February 2012 - 11:26 PM

I think threads like these perfectly illustrates how differently people approach languages.

Learning C can be useful, yes, but that doesn't mean it should be learned before C++ (nor does it mean C++ should be learned before C).

[...]

Learning C just for the syntax is unnecessary. The syntax is such a small part of programming.

In all honestly, I can only speak for myself here. The learning approach I mentioned earlier was very useful, particularly syntax part. When you have never written a line of code before, syntax is everything, and learning it is one of the first fundamental steps for understanding what you are looking at. And when you switch over to some other language with a familiar syntax, learning that will be also a hell of a lot easier. I probably would have struggled with C++ if it weren't for C.
Latest project: Sideways Racing on the iPad

#16 AllEightUp   Moderators   -  Reputation: 4272

Like
0Likes
Like

Posted 08 February 2012 - 07:10 AM


First off, learn "C" in the context of "C++".

But... why???

The question is "learn C before C++?", take the baby steps into C++ but learn the core language "FIRST". All the rest of your arguments get the same answer: "because you need to learn the basics first". Do so in the context of C++ so you are not learning the wrong things since, as you say, the languages *are* different to a certain degree. The whole pointer thing was just a very common basic missed knowledge that continually comes up, so I suggest learning that specifically if nothing else.

#17 cignox1   Members   -  Reputation: 723

Like
0Likes
Like

Posted 08 February 2012 - 07:21 AM

Learning C before C++ only means that once you move to C++ you need to forget all the things no longer needed. Why should you learn to use c strings when you can start with std::string? Or why should you ignore references? Or to use malloc/free instead than new/delete?

A better option would be to learn 'C++ without classes', but still, a lot of languages (Java and C# to start with) are highly OO so you can as well learn C++ the OO way...

I don't see reason why you would want to learn C if you target C++. And I don't see reason to learn Pascal if you want to program with Delphi, for that matter...

#18 Serapth   Crossbones+   -  Reputation: 5792

Like
0Likes
Like

Posted 08 February 2012 - 08:13 AM



First off, learn "C" in the context of "C++".

But... why???

The question is "learn C before C++?", take the baby steps into C++ but learn the core language "FIRST". All the rest of your arguments get the same answer: "because you need to learn the basics first". Do so in the context of C++ so you are not learning the wrong things since, as you say, the languages *are* different to a certain degree. The whole pointer thing was just a very common basic missed knowledge that continually comes up, so I suggest learning that specifically if nothing else.



Isn't it kinda like suggesting people learn French before learning English? They share a number of words and use the same alphabet, but are completely different languages. Sure, knowing one will make learning the other a bit easier, but it seems like a downright wasteful use of time.

#19 japro   Members   -  Reputation: 887

Like
0Likes
Like

Posted 08 February 2012 - 08:25 AM

I absolutely see no benefit in starting with "pure C" over "C++ without the fancy features". For a beginner the big challenge is learning to program, not learning to program in <language>.
To me it seems like you are intentionally wasting your time on learning stuff someone else arbitrarily considers "basics" just so you can throw them out the window later (it's not like you can get around learning what pointers are in C++).

#20 typedef struct   Members   -  Reputation: 230

Like
0Likes
Like

Posted 08 February 2012 - 09:30 AM

C++ is not the best language for learning pointers and fiddling with bits - C is better for that.
C++ is not the best language for learning object-oriented programming- C#/Java is better for that.
C++ is the best language for learning C++.
Anthony Umfer




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS