Page 1 of 1

Learning C++

Posted: Wed Jul 14, 2010 8:00 pm
by ajtgarber
A while ago I finished reading a book about learning C++ "Learning C++ through game programming", and I very quickly realized I knew C++ syntactically but I really couldn't do anything with it. I could/can only read and write text to the console. I've also kinda had this issue learning other languages (Objective-C), the books I've read only just seem to teach you syntax and not much else. 1) anyone else had this problem? 2) How should I go about learning the rest? 3) Am I just being stupid?

Code: Select all

HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE

Re: Learning C++

Posted: Wed Jul 14, 2010 8:38 pm
by dejai
The C++ language does not come bundled with graphics / graphical user interface libraries by default (unlike say java). The idea is to use third party libraries to create such programs. For example if you wanted to create a 2D video game you could install the SDL library and read through that libraries tutorials and learn how to use their third party graphics library. That would provide the graphical component to the game but you would still be required to write all the logic for the game in c++ such collision, artificial intellegence etc. Also from a historical standpoint graphics changes really quickly and would be very hard for the C++ committee to standardize across all systems so they don't even try and leave it up to someone else which gives programmers more freedom to choose or to create their own libraries. If you want to go even lower you could use C++ and assembly to directly access your video card and then write to the screen that way but we generally like to abstract that away because it is like re-inventing the wheel (it also wouldn't be portable across other systems with different video cards). So we rely on large code bases written by opengl for example that handle all that for us and let us develop the applications we want :)

Re: Learning C++

Posted: Thu Jul 15, 2010 5:05 am
by MrDeathNote
ajtgarber wrote:A while ago I finished reading a book about learning C++ "Learning C++ through game programming", and I very quickly realized I knew C++ syntactically but I really couldn't do anything with it. I could/can only read and write text to the console. I've also kinda had this issue learning other languages (Objective-C), the books I've read only just seem to teach you syntax and not much else. 1) anyone else had this problem? 2) How should I go about learning the rest? 3) Am I just being stupid?

Code: Select all

HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE
Reading books only gets you so far man. When it comes down to it, programming is a "Learn by doing" activity. I had this problem when i first started programming. Also do you mean that writing to the console is the only thing you know how to do, or did you expect to be making windows and stuff. Because as dejai already said you need 3rd party libs for that.

Re: Learning C++

Posted: Thu Jul 15, 2010 7:32 am
by ajtgarber
Thanks for the replies, yeah thats pretty much all I can do at the current moment, the book I got didn't go over files or anything else, just syntax and a bit of the STL

Re: Learning C++

Posted: Thu Jul 15, 2010 11:48 am
by MrDeathNote
ajtgarber wrote:Thanks for the replies, yeah thats pretty much all I can do at the current moment, the book I got didn't go over files or anything else, just syntax and a bit of the STL
I had the same book and i know it is truely shit. If I was you i'd get a different book.

Re: Learning C++

Posted: Thu Jul 15, 2010 12:04 pm
by mv2112
MrDeathNote wrote:
ajtgarber wrote:Thanks for the replies, yeah thats pretty much all I can do at the current moment, the book I got didn't go over files or anything else, just syntax and a bit of the STL
I had the same book and i know it is truely shit. If I was you i'd get a different book.
I have that book also, i would recommend Sam's Teach Yourself C++ in 24 hours, or Sam's Teach Yourself C++ in 21 Days

Re: Learning C++

Posted: Thu Jul 15, 2010 3:53 pm
by wearymemory
mv2112 wrote:
MrDeathNote wrote:
ajtgarber wrote:Thanks for the replies, yeah thats pretty much all I can do at the current moment, the book I got didn't go over files or anything else, just syntax and a bit of the STL
I had the same book and i know it is truely shit. If I was you i'd get a different book.
I have that book also, i would recommend Sam's Teach Yourself C++ in 24 hours, or Sam's Teach Yourself C++ in 21 Days
I wouldn't recommend it. In general, those books are terrible. Any self-respecting programmer knows that you cannot learn a programming language in 24 hours or 21 days, and books like those might even be contributing to the OP's problem, as well as many other's. Here's an excellent read on why: Teach Yourself Programming in Ten Years.

Another reason why you might feel like you have only learned the syntax of C++ is because the book you read was over game programming. That may work for languages like GML or Blitz because they were designed specifically for game development, but it will not work for a general-purpose language like C++. If you're going to learn a new language, then you need to learn it without any contingencies. Focus on learning the language for what it is: Multi-paradigm and general-purpose. If you do this, you'll find that you have a better understanding of the language, and the concepts from which it is derived. Above all, don't start out by using separate architectures designed for specific purposes (e.g. Allegro, SDL, OpenGL, etc.) until you are comfortable with your language.

Using programming patterns and designs that speed up rudimentary and complex development processes will also transfer to other languages, and can even be incorporated into your game programming, so I would suggest finding a few good resources on that as well. You won't find everything you need to know in any one book, you'll likely end up with quite a few different resources.

Now, with that said: You will only be able to truly teach yourself programming with time, coupled by experience, and the knowledge of design.

After you have a firm grasp on the language, why not check out Effective C++: 50 Specific Ways to Improve Your Programs and Design (2nd Edition) by Scott Meyers. Joshua Bloch, respected author and Java programmer who was inspired by Scott Meyer's literature to write Effective Java (Second Edition), recommended this book.

Re: Learning C++

Posted: Thu Jul 15, 2010 5:13 pm
by mv2112
wearymemory wrote:<Quoting wearymemory's post>
The books are more of a reference that you indirectly learn from, of course you cant learn C++ in 24 hours or 21 days, but you can look at the examples in the books and learn by actually programming.

Re: Learning C++

Posted: Thu Jul 15, 2010 6:17 pm
by XianForce
wearymemory wrote: I wouldn't recommend it. In general, those books are terrible.
That's one opinion... Honestly though, the information in the books is great. Just know that no matter what book you buy, you essentially won't 'learn' from it. You have to practice, and learning will come from experience. If your like me, and like to have a physical reference handy, Sams Teach Yourself C++ in 21 Days is great. Just don't expect to have everything mastered in 21 days.

Re: Learning C++

Posted: Thu Jul 15, 2010 6:37 pm
by wearymemory
XianForce wrote:Honestly though, the information in the books is great.
Perhaps, but I tend to stay away from such books as they can give the wrong impression, and are sometimes not as in-depth. Also, I was a bit brash when I called them "terrible," but I don't want the OP leaving the thread thinking that they could buy the book and be done with it because it happens.

Re: Learning C++

Posted: Thu Jul 15, 2010 6:40 pm
by XianForce
Yeah definitely ^^.

So bottomline -> Books are mostly going to used as a 'guiding source' and later as a reference. You will not actually 'learn' from them, no matter how much you think you do. The learning is going to come straight from the programming.

Re: Learning C++

Posted: Thu Jul 15, 2010 7:28 pm
by ajtgarber
Thanks for all the replies everyone :)

I think I'll try the "Learn C++ in 30 days" (or whatever it was) and take it from there. Thanks for the help :)

Re: Learning C++

Posted: Sat Jul 17, 2010 11:05 am
by WSPSNIPER
for me i keep learning more by just programming. i look back and understand things totally differently then i thought they were. like cout is and ostream variable and the << is an operator. i also understand object orientation a ton more like you can inherit from the sf::Render window class to make you own window instead of including a window in your engine class and if you have a pointer to a parent class it can point to any child class of that type. basically you just learn because a situation calls you to go outside the box and then once you get it to work you understand it...

drop the tutorials and try to do things yourself. if you run into trouble ask on a forum :) good luck