Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 19, 2012, 04:11 PM   #1
thekev
macrumors 603
 
thekev's Avatar
 
Join Date: Aug 2010
learning C++

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.
__________________
world's largest manufacturer of tin foil hats, none of that aluminum foil crap.
thekev is online now   0 Reply With Quote
Old Mar 19, 2012, 04:13 PM   #2
robvas
macrumors 68000
 
Join Date: Mar 2009
Location: USA
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/lear...-9781430218098
robvas is offline   3 Reply With Quote
Old Mar 19, 2012, 04:44 PM   #3
firewood
macrumors 603
 
Join Date: Jul 2003
Location: Silicon Valley
Quote:
Originally Posted by thekev View Post
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.
firewood is offline   0 Reply With Quote
Old Mar 19, 2012, 04:49 PM   #4
Angelo95210
macrumors 6502a
 
Angelo95210's Avatar
 
Join Date: Jan 2009
Location: Paris, France
To learn a new language, I love the O'Reilly books which are available on Amazon. (Learning C++)
__________________
Hackintosh G31M-S2L - Macbook 3,1
Angelo95210 is offline   0 Reply With Quote
Old Mar 19, 2012, 05:41 PM   #5
thekev
Thread Starter
macrumors 603
 
thekev's Avatar
 
Join Date: Aug 2010
Quote:
Originally Posted by firewood View Post
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.

Quote:
Originally Posted by robvas View Post
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/lear...-9781430218098
Checking that one. Amazon seems to have more reviews. I may order that.

Quote:
Originally Posted by Angelo95210 View Post
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.
__________________
world's largest manufacturer of tin foil hats, none of that aluminum foil crap.
thekev is online now   0 Reply With Quote
Old Mar 20, 2012, 01:17 AM   #6
WebMongol
macrumors member
 
Join Date: Sep 2004
Location: Bay Area, CA
C++ Books

Quote:
Originally Posted by thekev View Post
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-Ed...2223370&sr=8-1
or this one:
http://www.amazon.com/gp/product/020...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-...ref=pd_sim_b_1

Good luck.
WebMongol is offline   0 Reply With Quote
Old Mar 20, 2012, 07:09 AM   #7
robvas
macrumors 68000
 
Join Date: Mar 2009
Location: 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++
robvas is offline   0 Reply With Quote
Old Mar 20, 2012, 09:09 AM   #8
chrono1081
macrumors 604
 
chrono1081's Avatar
 
Join Date: Jan 2008
Location: 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++.
__________________
Mac Pro (2010): 3.33Ghz Intel Xeon (6 core) - 24 GB RAM - NVidia Quadro k5000
Macbook Air (2010): 2.13 Ghz Intel Core 2 Duo - 4GB RAM
chrono1081 is offline   0 Reply With Quote
Old Mar 20, 2012, 09:48 AM   #9
thekev
Thread Starter
macrumors 603
 
thekev's Avatar
 
Join Date: Aug 2010
Quote:
Originally Posted by robvas View Post
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.

Quote:
Originally Posted by chrono1081 View Post
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.
__________________
world's largest manufacturer of tin foil hats, none of that aluminum foil crap.
thekev is online now   0 Reply With Quote
Old Mar 20, 2012, 12:41 PM   #10
danwilliams
macrumors member
 
Join Date: Sep 2008
Quote:
Originally Posted by thekev View Post
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...
danwilliams is offline   1 Reply With Quote
Old Mar 20, 2012, 04:26 PM   #11
sero
macrumors member
 
Join Date: Aug 2008
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/
sero is offline   0 Reply With Quote
Old Mar 20, 2012, 05:48 PM   #12
thekev
Thread Starter
macrumors 603
 
thekev's Avatar
 
Join Date: Aug 2010
Quote:
Originally Posted by sero View Post
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.

Quote:
Originally Posted by danwilliams View Post
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. 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.
__________________
world's largest manufacturer of tin foil hats, none of that aluminum foil crap.
thekev is online now   0 Reply With Quote
Old Mar 20, 2012, 07:01 PM   #13
Cactus Dan
macrumors newbie
 
Join Date: Aug 2010
Howdy,

Here is a good dvd video tutorial series called "C++ Complete" on C++ and OpenGL:
http://www.3dbuzz.com/xcart/product....&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
Cactus Dan is offline   0 Reply With Quote
Old Mar 20, 2012, 08:30 PM   #14
macrumorsuser10
macrumors regular
 
Join Date: Nov 2010
Quote:
Originally Posted by thekev View Post
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.
__________________
Owning an Android phone makes a statement, and that statement is: "Yeah, this is where I am in life. It's not where I want to be, but I'm doing my best."
macrumorsuser10 is offline   1 Reply With Quote
Old Mar 20, 2012, 08:55 PM   #15
thekev
Thread Starter
macrumors 603
 
thekev's Avatar
 
Join Date: Aug 2010
Quote:
Originally Posted by macrumorsuser10 View Post

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.

Quote:
Originally Posted by macrumorsuser10 View Post
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.


Quote:
Originally Posted by Cactus Dan View Post
Howdy,

Here is a good dvd video tutorial series called "C++ Complete" on C++ and OpenGL:
http://www.3dbuzz.com/xcart/product....&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).
__________________
world's largest manufacturer of tin foil hats, none of that aluminum foil crap.

Last edited by thekev; Mar 20, 2012 at 09:02 PM.
thekev is online now   0 Reply With Quote
Old Mar 21, 2012, 01:24 AM   #16
chrono1081
macrumors 604
 
chrono1081's Avatar
 
Join Date: Jan 2008
Location: Isla Nublar
Quote:
Originally Posted by Cactus Dan View Post
Howdy,

Here is a good dvd video tutorial series called "C++ Complete" on C++ and OpenGL:
http://www.3dbuzz.com/xcart/product....&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.
__________________
Mac Pro (2010): 3.33Ghz Intel Xeon (6 core) - 24 GB RAM - NVidia Quadro k5000
Macbook Air (2010): 2.13 Ghz Intel Core 2 Duo - 4GB RAM

Last edited by chrono1081; Mar 21, 2012 at 02:51 AM.
chrono1081 is offline   0 Reply With Quote
Old Apr 1, 2012, 03:10 PM   #17
Cactus Dan
macrumors newbie
 
Join Date: Aug 2010
Howdy,
Quote:
Originally Posted by chrono1081 View Post
...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
Cactus Dan is offline   0 Reply With Quote
Old Apr 1, 2012, 03:23 PM   #18
chrono1081
macrumors 604
 
chrono1081's Avatar
 
Join Date: Jan 2008
Location: Isla Nublar
Quote:
Originally Posted by Cactus Dan View Post
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.
__________________
Mac Pro (2010): 3.33Ghz Intel Xeon (6 core) - 24 GB RAM - NVidia Quadro k5000
Macbook Air (2010): 2.13 Ghz Intel Core 2 Duo - 4GB RAM
chrono1081 is offline   0 Reply With Quote
Old Apr 1, 2012, 03:34 PM   #19
Cactus Dan
macrumors newbie
 
Join Date: Aug 2010
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.

Adios,
Cactus Dan
Cactus Dan is offline   0 Reply With Quote
Old Apr 1, 2012, 03:55 PM   #20
chrono1081
macrumors 604
 
chrono1081's Avatar
 
Join Date: Jan 2008
Location: Isla Nublar
Quote:
Originally Posted by Cactus Dan View Post
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.

Adios,
Cactus Dan
Thanks! I ordered them
__________________
Mac Pro (2010): 3.33Ghz Intel Xeon (6 core) - 24 GB RAM - NVidia Quadro k5000
Macbook Air (2010): 2.13 Ghz Intel Core 2 Duo - 4GB RAM
chrono1081 is offline   0 Reply With Quote
Old Apr 14, 2012, 11:58 PM   #21
softwareguy256
macrumors regular
 
Join Date: Jun 2010
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.
softwareguy256 is offline   0 Reply With Quote
Old Apr 17, 2012, 11:34 AM   #22
Mac_Max
macrumors 6502
 
Join Date: Mar 2004
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 ).

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.
Mac_Max is offline   2 Reply With Quote
Old Apr 17, 2012, 10:52 PM   #23
neowin
macrumors newbie
 
Join Date: Jun 2011
the best video tutorials for C++ out there -

http://thenewboston.org/list.php?cat=16
neowin is offline   0 Reply With Quote
Old Apr 18, 2012, 05:36 PM   #24
mully1121
macrumors member
 
Join Date: Dec 2009
Quote:
Originally Posted by neowin View Post
the best video tutorials for C++ out there -

http://thenewboston.org/list.php?cat=16
I second this recommendation, the guy really breaks it down well and does it in short easy-to-digest blocks.

Last edited by mully1121; Apr 18, 2012 at 05:38 PM. Reason: info already posted
mully1121 is offline   0 Reply With Quote
Old Apr 18, 2012, 09:12 PM   #25
ChrisA
macrumors G4
 
Join Date: Jan 2006
Location: Redondo Beach, California
Quote:
Originally Posted by thekev View Post
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.
ChrisA is offline   1 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Just learning joatmon iPhone/iPad Programming 4 Nov 5, 2013 11:47 PM
I Need Help Learning Objective-c!! Woodshark69 Mac Programming 11 Dec 14, 2012 07:21 AM
Learning Objective C iPadProd iPhone/iPad Programming 4 Nov 18, 2012 05:37 PM
Learning to code... SR71 iPhone/iPad Programming 9 Oct 11, 2012 07:20 PM

Forum Jump

All times are GMT -5. The time now is 09:03 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC