Page 1 of 2

Is STL a neccisity

Posted: Sun Apr 18, 2010 2:09 pm
by dream_coder
Hey all. Its been a while since I last posted. However I have just recieved some books I ordered off the internet. The one I am working through at the minute is "Beginning C++ through games programming", Im just about to start on references. Anyway there is a single chapter that covers the STL and introduces things like vectors. I was just wondering if it is a good idea to get a book that soley focuses on STL?

Re: Is STL a neccisity

Posted: Sun Apr 18, 2010 2:52 pm
by MrDeathNote
dream_coder wrote:Hey all. Its been a while since I last posted. However I have just recieved some books I ordered off the internet. The one I am working through at the minute is "Beginning C++ through games programming", Im just about to start on references. Anyway there is a single chapter that covers the STL and introduces things like vectors. I was just wondering if it is a good idea to get a book that soley focuses on STL?
I've read that book and to be honest it's absolute shit, it doesn't even cover classes or inheritance or anything to do with OOP. I would recommend Accelerated c++ practical programming by example. It introduces alot of stl functions from the very start. It's easy to read, covers every beginner aspect, isn't bulky at all. The stl gives c++ alot of power so it's good to get to grips with it.

Re: Is STL a neccisity

Posted: Sun Apr 18, 2010 3:15 pm
by dream_coder
I'll have to get that book. Ive already got C++: A Beginner's Guide, Second Edition (Beginner's Guides (McGraw-Hill))
Herbert Schildt ordered and on the way to me. "C++ through games programming" does cover classes but only in the last two chapters.

Re: Is STL a neccisity

Posted: Sun Apr 18, 2010 3:33 pm
by MrDeathNote
dream_coder wrote:I'll have to get that book. Ive already got C++: A Beginner's Guide, Second Edition (Beginner's Guides (McGraw-Hill))
Herbert Schildt ordered and on the way to me. "C++ through games programming" does cover classes but only in the last two chapters.
Your right it does cover classes, but not splitting classes into separate files which is so stupid ;)

Re: Is STL a neccisity

Posted: Sun Apr 18, 2010 6:00 pm
by programmerinprogress
dream_coder wrote:I'll have to get that book. Ive already got C++: A Beginner's Guide, Second Edition (Beginner's Guides (McGraw-Hill))
Herbert Schildt ordered and on the way to me. .
this is an excellent beginners book (I've said this a few thousand time but It was sueful when I tried to get a grip on the language), and it's Java equivalent isn't bad either


On the point of the STL, while it is important to understand what it does, how you use it and when you should and shouldn't use it, it isnt the most fundamental area of programming to start off learning with, there are much more basic concepts you need to wrap your head around, Arrays being one of them, it's good to have knowledge of statically allocated containers before you jump right on to templates and dynamically allocated containers, probably essential , actually.

Re: Is STL a neccisity

Posted: Sun Apr 18, 2010 6:33 pm
by Bullet Pulse
Yea, I personally went to knowing the basics like methods and primitive data types in Java from my Computer Science class to knowing a lot of C++ quickly from the C++: Beginning C++ Game Programming book.
I also looked up how to split up my files when the time came to do that, so it wasn't a big deal.
But whatever you are going to do, keep learning ;) .

Re: Is STL a neccisity

Posted: Sun Apr 18, 2010 10:09 pm
by avansc
Here, I'll actually answer the question.

No, STL is NOT a necessity.

Re: Is STL a neccisity

Posted: Mon Apr 19, 2010 2:15 pm
by TheOtherGyro
It's not a necessity, but it does save you the time of writing your own linked list.

Re: Is STL a neccisity

Posted: Mon Apr 19, 2010 2:59 pm
by Ginto8
avansc wrote:Here, I'll actually answer the question.

No, STL is NOT a necessity.
And oftentimes it isn't a good choice (for example, std::string's are a lot slower and resource-hogging than dynamic char arrays, and you can easily make a few templated functions that work on arrays that provide the same or better functionality than std::vectors). But your choice depends on resource limitations, your own skill, and just preference.

Re: Is STL a neccisity

Posted: Tue Apr 20, 2010 6:07 am
by dream_coder
Ive actually just got "C++ A beginners Guide", through the post. Just had a quick flick through it and it does seem to go into a lot more detail. Where as "C++ through Game Programming" only has two chapters on class, this book seems to have half its contents dedicated to just classes. Im still gonna finish "C++ through Game Programming", but then Im gonna either work through the other book or go through the chapters on things such as arrays, pointers and oop.

Re: Is STL a neccisity

Posted: Wed Apr 21, 2010 7:06 am
by dejai
Data structures form a very important role in sophisticated applications. I find that the STL provides a way of easily accessing useful data structures for solving problems. The issue is that STL is generally abused and I would really stress that the algorithm and the application design is far more important than "learning STL" however in your design you may find it easier to actually implement it with the help of STL. A simple example ( I am not saying this is the correct way to do it ) is if you had a Game Object Map and had a std::vector<GameObject*> to store pointers to game objects that would allow you to update them in your game loop. In terms of a book I would think an understanding of the data structures and their attributes would be much more helpful to you and then simply google for the STL structure that fits the purpose. Also STL is after you learn the core of C++ and algorithms and data structures.

Re: Is STL a neccisity

Posted: Wed Apr 21, 2010 9:16 am
by Trask
dejai wrote:Data structures form a very important role in sophisticated applications. I find that the STL provides a way of easily accessing useful data structures for solving problems. The issue is that STL is generally abused and I would really stress that the algorithm and the application design is far more important than "learning STL" however in your design you may find it easier to actually implement it with the help of STL. A simple example ( I am not saying this is the correct way to do it ) is if you had a Game Object Map and had a std::vector<GameObject*> to store pointers to game objects that would allow you to update them in your game loop. In terms of a book I would think an understanding of the data structures and their attributes would be much more helpful to you and then simply google for the STL structure that fits the purpose. Also STL is after you learn the core of C++ and algorithms and data structures.
I remember my first run in with STL in college, never used it before and I can say that once I got a grasp on it, it did make somethings easier especially when dealing with lists and vectors, but its NOT for beginning anything. It's meant to be used on top your existing knowledge of C++ and I wouldn't recommend even looking at it until you understand arrays and containers.

Re: Is STL a neccisity

Posted: Wed Apr 21, 2010 9:30 am
by GroundUpEngine
Trask wrote:
dejai wrote:Data structures form a very important role in sophisticated applications. I find that the STL provides a way of easily accessing useful data structures for solving problems. The issue is that STL is generally abused and I would really stress that the algorithm and the application design is far more important than "learning STL" however in your design you may find it easier to actually implement it with the help of STL. A simple example ( I am not saying this is the correct way to do it ) is if you had a Game Object Map and had a std::vector<GameObject*> to store pointers to game objects that would allow you to update them in your game loop. In terms of a book I would think an understanding of the data structures and their attributes would be much more helpful to you and then simply google for the STL structure that fits the purpose. Also STL is after you learn the core of C++ and algorithms and data structures.
I remember my first run in with STL in college, never used it before and I can say that once I got a grasp on it, it did make somethings easier especially when dealing with lists and vectors, but its NOT for beginning anything. It's meant to be used on top your existing knowledge of C++ and I wouldn't recommend even looking at it until you understand arrays and containers.
Agreed

Re: Is STL a neccisity

Posted: Wed Apr 21, 2010 10:27 am
by Falco Girgis
Trask wrote:
dejai wrote:Data structures form a very important role in sophisticated applications. I find that the STL provides a way of easily accessing useful data structures for solving problems. The issue is that STL is generally abused and I would really stress that the algorithm and the application design is far more important than "learning STL" however in your design you may find it easier to actually implement it with the help of STL. A simple example ( I am not saying this is the correct way to do it ) is if you had a Game Object Map and had a std::vector<GameObject*> to store pointers to game objects that would allow you to update them in your game loop. In terms of a book I would think an understanding of the data structures and their attributes would be much more helpful to you and then simply google for the STL structure that fits the purpose. Also STL is after you learn the core of C++ and algorithms and data structures.
I remember my first run in with STL in college, never used it before and I can say that once I got a grasp on it, it did make somethings easier especially when dealing with lists and vectors, but its NOT for beginning anything. It's meant to be used on top your existing knowledge of C++ and I wouldn't recommend even looking at it until you understand arrays and containers.
And dear, sweet god, vectors and STL are NOT a replacement for standard arrays. Too often I see college nublets abuse the living shit out of STL when they could (and should) have easily implemented the same thing with a static structure.

If you care that little about the efficiency of your code, write it in Java. My C background makes me cringe every time I see somebody stick things in a map/vector "just cuz."

If you need to store something in a plastic ziploc bag, don't throw it in a garbage bag.

Re: Is STL a neccisity

Posted: Wed Apr 21, 2010 11:21 am
by dream_coder
lol. Sorry this just makes me laugh. Not anything about u guys. Just that book I have been following "C++ through games programming". It briefly mentions arrays but for everything that could be stored in an array it uses a vector. Think Im definately going to be going through the other book before starting my own projects. From what I can gather from these forums "Beginning C++ through game programming" just teaches bad coding practice.