Re: C++
Posted by Crono on Thu Jul 5th at 7:09am 2007
The book is talking about inheritance at the same time as comments? ... I do not recommend this book. Next it probably suggests to use templates whenever possible and discusses operator overloading in great depth before discussing pointers, classes, or structures.

Crono
super admin
6628 posts
633 snarkmarks
Registered: Dec 19th 2003
Location: Oregon, USA
Blame it on Microsoft, God does.
Re: C++
Posted by Crono on Thu Jul 5th at 7:07pm 2007
It seemed that you were implying the book instructed you in the ways of advanced C++ programming (or at least the basis for all advanced C++ programming).
? quote:
... n the second hour, I examined the Hello World program and what the commands do. I also learnt about c++ comments (// Hello, this is a c++ comment) and c style comments (/* Hello this is a c styled comment */)
I also learnt about encapsulation, inheritance and polymorphism
I want to note that, if the book, at any point, says anything along the lines of, "Templates are a powerful tool that should be utilized as often as possible", the book should be ignored.
If it also discusses multiple inheritance and described why you should use it ... again, ignore it.
These are two things that a lot of people use and it makes their code very sloppy and often times makes it overtly complicated.
There's some other stuff too, but those are big ones. You'll see when you get to hour 16 or whatever.

Crono
super admin
6628 posts
633 snarkmarks
Registered: Dec 19th 2003
Location: Oregon, USA
Blame it on Microsoft, God does.
Re: C++
Posted by Le Chief on Fri Jul 6th at 12:40am 2007
Cool, thanks Captain, I'll remember that book.

Le Chief
member
2605 posts
382 snarkmarks
Registered: Jul 28th 2006
Location: Sydney, Australia
Re: C++
Posted by Cash Car Star on Fri Jul 6th at 12:48am 2007
QuArK's in Python. It's why they've been able to have so many user-created addons.

Cash Car Star
member
1260 posts
301 snarkmarks
Registered: Apr 7th 2002
Location: Connecticut (sigh)
Occupation: post-student
Re: C++
Posted by omegaslayer on Fri Jul 6th at 5:43am 2007
Well you don't want to dismiss templates....period..... I think the point crono was trying to make is that you should understand the underlaying code that IS templates (Or are we not speaking of STL - standard template library), then you can effectively use them.
Just wait till you get to pointers arron, you'll be tearing your hair out over the segmentation fault errors, but a good coder always knows where his pointers go awry. C++ coding is half knowledge, and half art (effective code anyways).

omegaslayer
member
2481 posts
401 snarkmarks
Registered: Jan 16th 2004
Location: Seattle, WA
Occupation: Sr. DevOPS Engineer
Re: C++
Posted by Yak_Fighter on Fri Jul 6th at 6:46am 2007
its red cause he's just that damn cool

Yak_Fighter
member
1832 posts
406 snarkmarks
Registered: Dec 30th 2001
Location: Indianapolis, IN
Occupation: College Student/Slacker
Re: C++
Posted by Crono on Fri Jul 6th at 7:37am 2007
If you want a pretty end all be all well explained wonderfully written (and correct) book on the actual C++ language, when you're ready, seek out C++ Primer Plus by Prata. I think it's in like the sixth or seventh edition. As far as I can tell the newer editions only add some explanation of newer standards and cost a great deal more. I think the current edition runs for almost $60 and I bought mine (3d edition) for $35. If you live anywhere near a college campus take a trip to their book store and you'll find more books (at an okay used price, if they have some used copies) than you can shake a stick at.
The great thing about the book is it goes about as deep as Stroustrup's books (primary designer/creator of the C++ language) but is far simple to understand. From what I've heard, his book is incredibly complicated and difficult to understand ... for people who've been using the language professionally for over a decade. Yikes.
Aaron, I would suggest ignoring the rest of this post. It might scare you away from programming.
Omegaslayer:
In general, I would recommend against using templates. Why you ask? Because you can't possibly guarantee what a template guarantees. It says "Any data type that can be created from now to the end of time can be used with this template" ... and there's no way IN HELL you can guarantee that because it encompasses user defined data types.
Now, of course, if you're very experienced and you just don't want to write yet another binary tree ... then by all means use the template in the STL, but in general ... they're really just not implemented properly. The reason why is because C++ is not inherently an object oriented programming language. It's C with a bunch of stuff on top. Now a language like Java is designed for that type of thing, which is why it's pre-made structures DO work for most all objects and the portions that you need to define for your class are, most generally, abstract and need to be overloaded locally.
In addition, most people just plain use templates when you don't need them. Templates are really something you should learn after you know the ins and outs of the language and can build these structures on your own (not to mention building a complete binary search tree with hash table nodes will teach you much of what you need to know about pointers)

Crono
super admin
6628 posts
633 snarkmarks
Registered: Dec 19th 2003
Location: Oregon, USA
Blame it on Microsoft, God does.
Re: C++
Posted by Crono on Fri Jul 6th at 7:03pm 2007
Something else I forgot to mention.
You'll want to pick up a Data Structures book at some point (or else you wont know what to do with your newly created data).
The book I have is okay. It's better than most, but you could probably do better. What you want to stay away from are books that say use templates for everything (which is much more predominant in data structure books) and I already explained why that's a bad idea.

Crono
super admin
6628 posts
633 snarkmarks
Registered: Dec 19th 2003
Location: Oregon, USA
Blame it on Microsoft, God does.
Re: C++
Posted by Le Chief on Sat Jul 7th at 2:44am 2007
Ok thankyou Crono. How long have you been doing c++ for?

Le Chief
member
2605 posts
382 snarkmarks
Registered: Jul 28th 2006
Location: Sydney, Australia
Re: C++
Posted by omegaslayer on Sat Jul 7th at 5:09am 2007
Crono-
Yup I agree with you on that. I've dealt with STL, and while I can see its usefulness, i've always coded my own binary tree (which BTW you don't ALWAYS want to use for everything) or hash table or quicksort (no debates as to which sort is better please).

omegaslayer
member
2481 posts
401 snarkmarks
Registered: Jan 16th 2004
Location: Seattle, WA
Occupation: Sr. DevOPS Engineer
Re: C++
Posted by Crono on Sat Jul 7th at 7:11am 2007
Well, if you can get the data sorted in a binary structure that's best since you got that gorgeous O(lg n) time complexity. Merge sort is better all-around though, for most situations.
I learned C++ when I stated by degree, and I've been doing that for awhile. I took is slow for a couple years and only recently (last two or three years) really started taking heavier course loads. But, six years.
But, I'll tell you that the actual act of learning C++ was the easiest and least important part of my degree and programming in general. Design is where it's at, if you can't do that, you can't do s**t (I've ran into many people like this and it always astonishes me that you'd get this degree specifically to get a job as a code when your skill set allows you to do things far more interesting and rewarding). You're basically an assembly line worker who can code other people's designs, which is boring and often times very frustrating. After all the entire point of learning programming methodology and languages is to solve problems. If someone learns "to code" just so they can, it's a horrible and completely useless reason, and their skills will be in the same shape, most likely.

Crono
super admin
6628 posts
633 snarkmarks
Registered: Dec 19th 2003
Location: Oregon, USA
Blame it on Microsoft, God does.