Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411492 Posts in 69377 Topics- by 58433 Members - Latest Member: Bohdan_Zoshchenko

April 29, 2024, 07:25:31 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)I want to learn C++, but I don't know where to begin!
Pages: 1 [2]
Print
Author Topic: I want to learn C++, but I don't know where to begin!  (Read 11319 times)
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #20 on: September 19, 2008, 07:08:54 AM »

I get the impression that a lot of people who think C++ is hard to learn think that you have to start out using pointer, classes, and the other more advanced stuff. I spent at least a year programming in C++ without knowing the first thing about pointers and classes. In that time I just familiarized myself with simple things like input, output, and functions, which you're going to encounter in any other language anyway. Only after I was comfortable with the basics of the language did I start learning about the more advanced and low-level concepts (I didn't even start to use casting until after I have learned about pointers).
If you keep it simple, it should be just as easy to start with C++ as with any other language.

I don't think that C++ is hard to learn, and anyone who wants to call themselves a coder has to learn it. I just don't think that it's right to start with it. It will be oh so much easier to understand once you have a general knowledge of programming. I mean, look at the "Your first programming language" thread. Do you see C++ anywhere? For a lot of people, including me the first language was BASIC, because BASIC was the simplest language available at the time that most of us were growing up. Nowadays we have things like Processing, ActionScript and Python, which I would say are the modern equivalents of BASIC. (Visual Basic, ironically, is not and I would urge people to stay away from it).

I don't really understand why you would advise someone who has never touched programming to spend a day fiddling with compilers and a complex low level language when they can have something on the screen in the next 10 minutes if they use something like Processing or Pygame.

Yes, you don't have to use pointer and classes in C++, but then there is absolutely no point in using it. They wouldn't even get to the things that make C++ C++ until a very long time from now.
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Hajo
Level 5
*****

Dream Mechanic


View Profile
« Reply #21 on: September 19, 2008, 07:27:41 AM »

I mean, look at the "Your first programming language" thread. Do you see C++ anywhere? For a lot of people, including me the first language was BASIC, because BASIC was the simplest language available at the time that most of us were growing up.

BASIC was just readily available on C64 and such ... and you really had a hard time to find C++ for C64 those times Tongue

I don't think that is really evidence that BASIC is better to start with than C++ is. Yet C++ has such of a hell of a lot of features, I really think one has an easier path to if they start with a less feature-rich language. That definitely includes BASIC.

Instead of BASIC I'd suggest Java as first language, which is in a way very similar to C++, but has a lot less traps for new programmers. C# might do as well, but already has more gimmicks.

But as others said, it is possible to learn C++ right away. Start with the simple things, and work your way step by step. That should work. A good books will help, tutorials from the web will do so as well.

Edit:

The original poster asked where to start and we discuss if C++ is suitable ...

Google is your friend, though. Try "C++ tutorials" and it throws heaps of sites at you.

One that looked sensible to me: http://www.functionx.com/cpp/

Beware though, I chose this without really looking. Guess there are better among the google result list. But it's a start, definitely Tongue
« Last Edit: September 19, 2008, 07:39:49 AM by Hajo » Logged

Per aspera ad astra
increpare
Guest
« Reply #22 on: September 19, 2008, 07:49:39 AM »

am still a bit scared of the whole idea of 'scripting languages'  tbh ...

Why so scared? Call them "dynamically typed bytecode-interpreted languages" if it helps? Wink But, in all seriousness, is it the dynamic typing or the performance that puts you off?
Dynamic typing?  Nah; I'm rather fond of PHP, for instance ;P

Quote
Large programs can be (and have been) written in Python, so I think calling it a scripting language isn't entirely accurate.
Right.  I was talking about the use of python as a scripting language.  These feelings are entirely due to the fact that I haven't really had any use for a scripting language in any of my projects yet though, I guess.
Logged
muku
Level 10
*****


View Profile
« Reply #23 on: September 19, 2008, 07:57:51 AM »

am still a bit scared of the whole idea of 'scripting languages'  tbh ...

Why so scared? Call them "dynamically typed bytecode-interpreted languages" if it helps? Wink But, in all seriousness, is it the dynamic typing or the performance that puts you off?
Dynamic typing?  Nah; I'm rather fond of PHP, for instance ;P

Now there's a language I hate the guts of Grin The "language" part of it only, though. It's ubiquity in the server scripting niche and its strong libraries do make it very useful, undeniably.


Quote
Quote
Large programs can be (and have been) written in Python, so I think calling it a scripting language isn't entirely accurate.
Right.  I was talking about the use of python as a scripting language.  These feelings are entirely due to the fact that I haven't really had any use for a scripting language in any of my projects yet though, I guess.

Ah, I see. If you ever think about embedding a scripting language in a game or similar, I would recommend against Python anyway because it's a bit too bloated for that already in my opinion. Usually Lua fits the bill nicely here.
Logged
Gnarf
Guest
« Reply #24 on: September 19, 2008, 08:08:58 AM »

I bet The-Imp knows C++ by now all thanks to this discussion Grin
Logged
David Pittman
Level 2
**


MAEK GAEM


View Profile WWW
« Reply #25 on: September 19, 2008, 01:01:27 PM »

Thank you all for the tips, pointers, links, and such.
 Beer!
Oh I see what you did there!!

...

No?

 Sad
Logged

Cymon
Level 9
****


Computer Kid


View Profile WWW
« Reply #26 on: September 19, 2008, 03:13:42 PM »

dang it, too late to plug Cymon's Games.

Seriously, I learned by have 100 or so examples on hand that I could refer to and trying to write my own. 'Course that was back in BASIC on the C64, but still.
Logged

Cymon's Games, free source code, tutorials, and a new game every week!
Follow me on twitter
isaac
Level 2
**



View Profile WWW
« Reply #27 on: September 19, 2008, 09:27:53 PM »

To move a little off topic, what languages would people recommend for doing 'real', cross-platform development.

I've got pretty good actionscript skills (it's my day job), but I really want to pick up a 'real' language, so I can actually run code at native speed and do cool stuff, rather than cool stuff for the web.

I get the impression that C++ is the ultimate destination, but is there a better option to ease the move from a virtual machine, memory-managed language like AS3 to a real language?
Logged

Zaphos
Guest
« Reply #28 on: September 19, 2008, 11:05:02 PM »

To move a little off topic, what languages would people recommend for doing 'real', cross-platform development.

I've got pretty good actionscript skills (it's my day job), but I really want to pick up a 'real' language, so I can actually run code at native speed and do cool stuff, rather than cool stuff for the web.

I get the impression that C++ is the ultimate destination, but is there a better option to ease the move from a virtual machine, memory-managed language like AS3 to a real language?
Maybe start your own thread? Wink

But anyway ... a virtual machine, memory-managed language IS a real language.  That out of the way, if you don't want memory managed, C or C++ is pretty much the way to go.  If you already know AS3 well, I don't see much point in taking a detour.
Logged
isaac
Level 2
**



View Profile WWW
« Reply #29 on: September 19, 2008, 11:19:26 PM »

But anyway ... a virtual machine, memory-managed language IS a real language.  That out of the way, if you don't want memory managed, C or C++ is pretty much the way to go.  If you already know AS3 well, I don't see much point in taking a detour.

Okay, sounds like I've just gotta man up and learn it.
Logged

Cymon
Level 9
****


Computer Kid


View Profile WWW
« Reply #30 on: September 20, 2008, 11:10:31 AM »

To move a little off topic, what languages would people recommend for doing 'real', cross-platform development.

I've got pretty good actionscript skills (it's my day job), but I really want to pick up a 'real' language, so I can actually run code at native speed and do cool stuff, rather than cool stuff for the web.

I get the impression that C++ is the ultimate destination, but is there a better option to ease the move from a virtual machine, memory-managed language like AS3 to a real language?
I've stated my opinion on this before, but I do not like scripting languages (like ruby), I do not like "virtual machine" languages (like Java or C#) because those languages will come and go and I don't want to be a part of that. Once exception might be python. I'm checking it out and I can't help but like it. But otherwise, generally speaking, I distance myself from them. When someone needs to write an OS how do they do it? C/C++. That's why I think C/C++ rocks the casaba and why I use C/C++.

Of course at work I use C# and am teaching myself python, so I guess it's unavoidable.
Logged

Cymon's Games, free source code, tutorials, and a new game every week!
Follow me on twitter
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #31 on: September 20, 2008, 01:31:17 PM »

I think C++ is good for operating systems and games which require hundreds of thousands or millions of lines of code, but less useful for simpler programs and simpler games: C++ was really designed because with C it's hard to make a program larger than 100,000 lines without it breaking or becoming overwhelming, C++ added namespaces and object orientation, breaking the program up into manageable chunks, in order to break through the 100,000 line limit. That's my understanding of C++ history, anyway.

Most of the games we make here aren't 100,000 lines of code, even the more ambitious ones. I suspect even Aquaria doesn't use that many lines (though only Alec would know for sure). My games are around 10,000-15,000 lines of GML code.
Logged

Zaphos
Guest
« Reply #32 on: September 20, 2008, 01:45:13 PM »

I've stated my opinion on this before, but I do not like scripting languages (like ruby), I do not like "virtual machine" languages (like Java or C#) because those languages will come and go and I don't want to be a part of that. Once exception might be python. I'm checking it out and I can't help but like it. But otherwise, generally speaking, I distance myself from them. When someone needs to write an OS how do they do it?
A variant of C#Wink

"People use it to write operating systems" is a terrible argument for C++.  Kernels are often written in straight C, but for reasons that don't matter much to an application-level developer.

And what does it mean for a language to 'go'?  Language support lasts for a long, long time.  And Java and C# are still extremely popular languages.  And it's not like C/C++ is 'future proof' -- it's a poor language for correctness proofs, its model for parallelism is notoriously painful, and (apparently) no one can write significantly complex programs in C/C++ without endless security problems.
« Last Edit: September 20, 2008, 01:49:15 PM by Zaphos » Logged
Problem Machine
Level 8
***

It's Not a Disaster


View Profile WWW
« Reply #33 on: September 20, 2008, 02:46:00 PM »

Isaac:
I think that a good place to be in the transition from AS3 to C++ is understanding to some extent what AS is doing with memory. Sure, a lot of it is behind the scenes, but AS already has implicitly a lot of the things that C++ makes explicit. What I'm thinking of is passing references vs passing values. In Actionscript, this is tied to variable type, so for example if you pass an int to a function
Code:
public function doAThing(parameter:int):void
Then the value is copied and passed to the function. Any changes you make to the value within the function has no effect on whatever you passed. Conversely, if you pass a something that derives from the "Object" class (which MOST variables in AS do)...
Code:
public function doADifferentThing(parameterArray:Array):void
Then you're really passing a REFERENCE to that array; any changes you make to it in that function will affect the array at wherever you called it as well. I'm sure you already know all this if AS is your job, but the fundamental difference between C++ and AS is that instead of this being all tied up in variable types this is UNDER YOUR CONTROL. You can pass ints by reference, and arrays(or vectors, which you should look up if you're used to AS arrays) by value.

So, uh, basically, to answer your question as best as I'm able, I'd say that the best path from AS3 to C++ is a deeper understanding of AS and the way it's already handling your memory. Once you understand what it's doing, you'll be better equipped to do the same thing manually when you get to C++.
Logged

Madnis
Level 0
**


Vincent, were you programmed to bug me?


View Profile
« Reply #34 on: September 23, 2008, 10:50:56 AM »

I sort of the hate the "learn C first to learn C++" camp, but there is something valuable there. IMHO if you started C++ using only the C-equivalent subset of the language, you might be on your way. That is, ignore classes, templates, and the like--- stick to procedural programming. After that, exercises like writing your own linked-list or stack are decent introductions to memory management and objects. You might try these SDL tutorials (http://lazyfoo.net/SDL_tutorials/index.php). Keep a good reference on hand (http://www.cplusplus.com/reference/), and look stuff up often.

However, the fact is that learning C++ is not just about learning the language, but also about compilers, linking, project management, design.... If you want to work cross-platform, you will spend some time with CMake or SCons.... it's a pretty big undertaking, and one could definitely spend all their time learning and wake up a year later never having actually made anything.

If you're very serious about learning C++ 'The Right Way' (TM), you will want to pick up Bjarne Stroustrup's book (his homepage), and The C++ Standard Library by Josuttis. These are not tutorial books or 'learn C++ in 21 minutes', but will help you to know exactly what each piece of your code does and to me definitely represent the red pill of C++ programming.

Don't let C++ intimidate you, just check your priorities.
Logged

David Pittman
Level 2
**


MAEK GAEM


View Profile WWW
« Reply #35 on: September 23, 2008, 11:23:13 AM »

I sort of the hate the "learn C first to learn C++" camp, but there is something valuable there. IMHO if you started C++ using only the C-equivalent subset of the language, you might be on your way. That is, ignore classes, templates, and the like--- stick to procedural programming.

I'm inclined to agree, but I might be biased because that's how I got into C++. The modern academic approach of teaching OO fundamentals in easier languages (Java when I went to college, C# in some places now?) always seemed backwards to me, because it makes a lot more sense to me to start with very straightforward procedural programming and then layer OO on top of that. Trying to jump straight into understanding class hierarchies and such when you've barely written a for-loop is the wrong way to do it, in my opinion. Plus, if you start with plain C, you'll learn all about working directly with memory and things like why C/C++ don't have strings as an atomic type, and then you'll understand things like std::string better when you get into C++.
Logged

Powergloved Andy
Guest
« Reply #36 on: September 23, 2008, 01:04:21 PM »

C++ for me was a bit difficult at first to learn. I actually really couldn't grasp it until I took a class on it for college.  Sad
Logged
Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic