Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

thekev

macrumors 604
Original poster
Aug 5, 2010
7,005
3,343
Okay sort of similar to my last thread, but can anyone suggest a good method for learning such a language? All I ever read is that it's annoying to learn. Would books be the way to go? Night/online courses? I really have no idea as my background isn't in programming.
 

firewood

macrumors G3
Jul 29, 2003
8,106
1,343
Silicon Valley
Okay sort of similar to my last thread, but can anyone suggest a good method for learning such a language? All I ever read is that it's annoying to learn. Would books be the way to go? Night/online courses? I really have no idea as my background isn't in programming.

Different people learn differently. Figure out what's the best learning setup for you. Personally. Not what worked for some other random person.
 

thekev

macrumors 604
Original poster
Aug 5, 2010
7,005
3,343
Different people learn differently. Figure out what's the best learning setup for you. Personally. Not what worked for some other random person.

With software I haven't taken a course since college (quite some time ago) so that's generally been a matter of reading books. I asked with this one because it's supposedly an annoying topic to learn. I don't expect to be writing programs or anything major. It's used in writing shaders quite a lot, and many stock ones are written in C or C++, so I wanted to be able to read this stuff properly. The post was just looking for leads or suggestions. It's not intended as a replacement for doing my own research. Anyway I just wanted to respond to that so that you don't think I'm simply lazy.

A book is a lot faster than a Class.

Start out with "Learn C on the Mac". You can use all your C knowledge when you learn C++ or Objective-C, and this book will show you ho wto use Xcode which is important since you're on a Mac.

http://www.barnesandnoble.com/w/lea...00000630-_-Learn+C+on+the+Mac-_-9781430218098

Checking that one. Amazon seems to have more reviews. I may order that.

To learn a new language, I love the O'Reilly books which are available on Amazon. (Learning C++)

That name sounds familiar. I'll look them up.
 

WebMongol

macrumors member
Sep 19, 2004
50
0
Bay Area, CA
C++ Books

Okay sort of similar to my last thread, but can anyone suggest a good method for learning such a language? All I ever read is that it's annoying to learn. Would books be the way to go? Night/online courses? I really have no idea as my background isn't in programming.

If you are new to programming - start with this solid book:
http://www.amazon.com/Primer-Plus-E...6402/ref=sr_1_1?ie=UTF8&qid=1332223370&sr=8-1
or this one:
http://www.amazon.com/gp/product/0201721481/ref=cm_cr_asin_lnk

Each book is around 1000 pages. C++ is heavy duty language for professional programming with 25+ year of history. Learning C++ would require substantial commitment and time investment.

If you are fluent in other programming language I would start with shorter book:

http://www.amazon.com/Accelerated-C-Practical-Programming-Example/dp/020170353X/ref=pd_sim_b_1

Good luck.
 

robvas

macrumors 68040
Mar 29, 2009
3,240
629
USA
You might also want to play around with a language such as Python or Ruby to get the basics of programming before you have to deal with the very strict requirements of C++
 

chrono1081

macrumors G3
Jan 26, 2008
8,446
4,146
Isla Nublar
Books are the best way to go in my opinion. C++ can be boring to learn, and it does take much more effort than C or something like Objective-C so be prepared for that. In my opinion though its not near as hard as people make it out to be, its just harder to get very good at.

Since you've never programmed before, maybe start with an easier language just to pick the basic ideas up (C is a great start). You don't have to be an expert at the easier language by any means but as long as you grasp these concepts:

-variables
-loops
-functions
-structs
-conditional statements
-maybe classes (depending on the language, although this can wait)

You should be good to go for C++.
 

thekev

macrumors 604
Original poster
Aug 5, 2010
7,005
3,343
You might also want to play around with a language such as Python or Ruby to get the basics of programming before you have to deal with the very strict requirements of C++

Python is the other thing I'm studying at the moment, so that is covered. I have never actually come across Ruby.

Books are the best way to go in my opinion. C++ can be boring to learn, and it does take much more effort than C or something like Objective-C so be prepared for that. In my opinion though its not near as hard as people make it out to be, its just harder to get very good at.

Since you've never programmed before, maybe start with an easier language just to pick the basic ideas up (C is a great start). You don't have to be an expert at the easier language by any means but as long as you grasp these concepts:

-variables
-loops
-functions
-structs
-conditional statements
-maybe classes (depending on the language, although this can wait)

You should be good to go for C++.

I might try C if it helps understand the other. Also I started on Python. If I recall correctly, you use many of the same programs in your work. I could always see how far I get with books before getting stuck, but I hate developing bad habits early on. That's usually a concern with any new software or workflow. Initially the purpose of this is just writing custom shaders, but I do want to take the time to learn the language effectively.
 

danwilliams

macrumors member
Sep 15, 2008
46
0
I might try C if it helps understand the other. Also I started on Python. If I recall correctly, you use many of the same programs in your work. I could always see how far I get with books before getting stuck, but I hate developing bad habits early on. That's usually a concern with any new software or workflow. Initially the purpose of this is just writing custom shaders, but I do want to take the time to learn the language effectively.

I am twenty years in with software development and I am still finding better ways to use the language effectively. It's a never ending process. Jump on in and along your journey you will come across code/books/forums/people that will help in that goal. Just be relentless in that pursuit every single day and you will be way ahead of the curve.

May the force be with you...
 

sero

macrumors member
Aug 28, 2008
91
14
This is pretty decent (and free):
Code:
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-096-introduction-to-c-january-iap-2011/
 

thekev

macrumors 604
Original poster
Aug 5, 2010
7,005
3,343
This is pretty decent (and free):
Code:
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-096-introduction-to-c-january-iap-2011/

I read through the intro and a little of the second part. I'm going to look at the first couple lectures and exercises this evening.

I am twenty years in with software development and I am still finding better ways to use the language effectively. It's a never ending process. Jump on in and along your journey you will come across code/books/forums/people that will help in that goal. Just be relentless in that pursuit every single day and you will be way ahead of the curve.

May the force be with you...

+1 for the Star Wars reference:D. I'm not trying to become a programmer or anything of that sort. I keep bumping into stuff that's written via C++ or Python and I wanted to better understand how the languages work rather than just memorizing details relative to a given application without that level of comprehension. I feel like that kind of learning path leads to bad working habits that become more difficult to correct later. As I noted my research isn't limited to starting a thread here (as that would be silly). It's just helpful getting a range of suggestions and sometimes warnings on common pitfalls.
 

macrumorsuser10

macrumors 6502
Nov 18, 2010
359
445
Okay sort of similar to my last thread, but can anyone suggest a good method for learning such a language? All I ever read is that it's annoying to learn. Would books be the way to go? Night/online courses? I really have no idea as my background isn't in programming.

C++ is one of the most powerful and difficult programming languages; I know this because I'm a professional software engineer, and I write C++ code. I learned this language in undergrad, used it in grad school, and then spent many years as a professional learning best practices and idioms from my own mistakes and by reviewing other professionals' coding. This is a programming language that not too many engineers can truly master.

From what you wrote, you want a "casual" programming language to start learning programming in general. Try JavaScript or Python to learn about functions, loops, and other programming language constructs that are applicable to almost all other languages.

If you are serious about C++, then the best bet is to start off with a class at a local junior college where the instructor can help you learn from your mistakes and teach you best programming practices.
 

thekev

macrumors 604
Original poster
Aug 5, 2010
7,005
3,343
From what you wrote, you want a "casual" programming language to start learning programming in general. Try JavaScript or Python to learn about functions, loops, and other programming language constructs that are applicable to almost all other languages.

I mainly wanted the ability to write my own shaders. I am not going into what would be considered software development. I'm working on learning python simultaneously, which is something I should have done long ago, but at least I'm doing it now. It's quite popular as a scripting language.

If you are serious about C++, then the best bet is to start off with a class at a local junior college where the instructor can help you learn from your mistakes and teach you best programming practices.

It would end up being a night course if I did that. Given that the summer term for such a thing would still be at least a couple months away, I do have time to review some books before then. A course does sound appealing. I'm kind of paranoid about developing bad working habits.


Howdy,

Here is a good dvd video tutorial series called "C++ Complete" on C++ and OpenGL:
http://www.3dbuzz.com/xcart/product.php?productid=30&cat=12&page=1

Even though it's mainly using MS Visual Studio on Windows, they use cross platform frameworks, GLUT, wxWidgets and SDL, so following along the lessons on Mac is fairly easy. It's well worth the price.

Adios,
Cactus Dan

Thanks but that seems like they're covering a lot of topics in a limited amount of time. For $100, I feel like I'd be better off with $100 worth of books (assuming quality books).
 
Last edited:

chrono1081

macrumors G3
Jan 26, 2008
8,446
4,146
Isla Nublar
Howdy,

Here is a good dvd video tutorial series called "C++ Complete" on C++ and OpenGL:
http://www.3dbuzz.com/xcart/product.php?productid=30&cat=12&page=1

Even though it's mainly using MS Visual Studio on Windows, they use cross platform frameworks, GLUT, wxWidgets and SDL, so following along the lessons on Mac is fairly easy. It's well worth the price.

Adios,
Cactus Dan

Hm....I may get that just for the OpenGL tutorials. OpenGL tutorials that are good are hard to come buy.

The Blue Book doesn't really teach OpenGL anymore, it only teaches their wrapper and the Red Book is full of deprecated API's. NeHe is severely outdated so maybe I'll give these a shot.

If anyone used these, please let me know what you thought about them, especially the OpenGL sections. I'm familiar with OpenGL but I just don't feel like I know enough of it and its hard to find good resources on.
 
Last edited:

Cactus Dan

macrumors member
Aug 8, 2010
30
0
Howdy,
...If anyone used these, please let me know what you thought about them, especially the OpenGL sections. I'm familiar with OpenGL but I just don't feel like I know enough of it and its hard to find good resources on.
The videos go from the basics (drawing a 3D cube) to creating a scene graph and working with shaders. I've gone through all of the lessons, following along using Xcode.

Adios,
Cactus Dan
 

chrono1081

macrumors G3
Jan 26, 2008
8,446
4,146
Isla Nublar
Howdy,

The videos go from the basics (drawing a 3D cube) to creating a scene graph and working with shaders. I've gone through all of the lessons, following along using Xcode.

Adios,
Cactus Dan

So definitely worth the money? If so I'll be buying these very soon.
 

Cactus Dan

macrumors member
Aug 8, 2010
30
0
Howdy,

Yes, I think it was well worth the money. You'll get C++ Volumes 1 through 5 plus the OpenGL In-Depth. The OpenGL In-Depth is 73 lessons. Of course I had to figure out how to set up the projects in Xcode, compared to them using MSVC++, but there was plenty of information on the internet to get it figured out, even for an old guy like me. :D

Adios,
Cactus Dan
 

chrono1081

macrumors G3
Jan 26, 2008
8,446
4,146
Isla Nublar
Howdy,

Yes, I think it was well worth the money. You'll get C++ Volumes 1 through 5 plus the OpenGL In-Depth. The OpenGL In-Depth is 73 lessons. Of course I had to figure out how to set up the projects in Xcode, compared to them using MSVC++, but there was plenty of information on the internet to get it figured out, even for an old guy like me. :D

Adios,
Cactus Dan

Thanks! I ordered them :)
 

softwareguy256

macrumors regular
Jun 5, 2010
131
0
Read every page of Bjarne's book, then read every page of scott meyer's books. If you are a beginner it may take several years of experience to be able to put everything together. Where's that 10,000 hours statistic I keep hearing about?

When you are done with that, thoroughly understand boost. then you too will be a C++ guru. The reward at the end is well worth the hardships.

Do not take shortcuts, you will write very bad code and your potential will be stunted, e.g. you will never get hired at the most prestigious firms out there.
 

Mac_Max

macrumors 6502
Mar 8, 2004
404
1
I didn't find C++ to be particularly difficult to learn. I actually had a harder time with Objective C than C++. There are a few things that will really make life easier for you:

Don't be lazy and skip creating copy constructors, destructors & assignment/equality operators for classes that need them (those that contain pointers you need to deep copy). Being lazy is a good way to introduce subtle bugs.

Learn RAII. Link 1, Link 2.

Don't use heap semantics (pointers) just because its cool or fun (well except for learning projects and breakable toys) when you're better served by stack semantics; i.e. variables that will never be passed between functional units or passed as arguments to other functions. Any time you use a pointer, you're opening yourself up to the possibility of a memory leak, and when you're not dealing with some massive object larger than your stack or a large object that has to be passed to a function you're not receiving any benefit by using a pointer. Stroustrup has been trying to get this message out for years but its very hard to convince people to not throw pointers at everything (partially because pointers are what make C/C++/Obj C better than those other inferior languages :rolleyes:).

Also related, try to pass objects by reference where possible. There are many fringe benefits besides being able to, in many cases, use simpler syntax. At the very least, remember to pass your objects as pointers so you're not creating copies left and right for no reason. Primitive types (int, bool, float, char, etc) can be passed by value.

Learn how to use Smart Pointers.

Learn Const correctness.

Try to rely on composition rather than inheritance. This will be hard initially since deciding which is better is very much a decision influenced by past experience and most of your teaching material will have you creating all sorts of inheritance chains. Just keep an open mind to how you implement things and you'll be fine.
 

ChrisA

macrumors G5
Jan 5, 2006
12,541
1,653
Redondo Beach, California
Okay sort of similar to my last thread, but can anyone suggest a good method for learning such a language? All I ever read is that it's annoying to learn. Would books be the way to go? Night/online courses? I really have no idea as my background isn't in programming.


You say your background is NOT is programming. All those suggestions to buy a book are only good if you DO already have a background in programing.

Learning to program is NOT the same as learning a programming language. It is like writing a novel. You could write a novel in Spanish or English but in order to do so you h=first have to learn how to develop characters and story lines and so on.

Class es at a community collage are the best way. Then you have access to an instructor and may get to work on projects with other students.

If you did have a software background then I'd say to just get a reference book and use C++ on the next project and look up everything as you need it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.