Is STL a neccisity

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

dream_coder
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 34
Joined: Sat Mar 27, 2010 5:16 pm

Is STL a neccisity

Post 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?
Image
Image
Image
User avatar
MrDeathNote
ES Beta Backer
ES Beta Backer
Posts: 594
Joined: Sun Oct 11, 2009 9:57 am
Current Project: cocos2d-x project
Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
Programming Language of Choice: C/++
Location: Belfast, Ireland
Contact:

Re: Is STL a neccisity

Post 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.
http://www.youtube.com/user/MrDeathNote1988

Image
Image

"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
dream_coder
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 34
Joined: Sat Mar 27, 2010 5:16 pm

Re: Is STL a neccisity

Post 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.
Image
Image
Image
User avatar
MrDeathNote
ES Beta Backer
ES Beta Backer
Posts: 594
Joined: Sun Oct 11, 2009 9:57 am
Current Project: cocos2d-x project
Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
Programming Language of Choice: C/++
Location: Belfast, Ireland
Contact:

Re: Is STL a neccisity

Post 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 ;)
http://www.youtube.com/user/MrDeathNote1988

Image
Image

"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
User avatar
programmerinprogress
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Wed Oct 29, 2008 7:31 am
Current Project: some crazy stuff, i'll tell soon :-)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++!
Location: The UK
Contact:

Re: Is STL a neccisity

Post 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.
---------------------------------------------------------------------------------------
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D

I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
User avatar
Bullet Pulse
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 89
Joined: Sun Feb 21, 2010 6:25 pm

Re: Is STL a neccisity

Post 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 ;) .
Last edited by Bullet Pulse on Wed Apr 21, 2010 5:47 pm, edited 1 time in total.
Image
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Is STL a neccisity

Post by avansc »

Here, I'll actually answer the question.

No, STL is NOT a necessity.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
TheOtherGyro
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 4
Joined: Mon Apr 19, 2010 1:38 pm
Current Project: Some surrealist machine-building platformer thing.
Favorite Gaming Platforms: PC Master Race
Programming Language of Choice: C++ master race
Contact:

Re: Is STL a neccisity

Post by TheOtherGyro »

It's not a necessity, but it does save you the time of writing your own linked list.
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: Is STL a neccisity

Post 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.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
dream_coder
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 34
Joined: Sat Mar 27, 2010 5:16 pm

Re: Is STL a neccisity

Post 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.
Image
Image
Image
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Re: Is STL a neccisity

Post 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.
User avatar
Trask
ES Beta Backer
ES Beta Backer
Posts: 738
Joined: Wed Oct 29, 2008 8:17 pm
Current Project: Building a 2D Engine
Favorite Gaming Platforms: Sega Genesis and Xbox 360
Programming Language of Choice: C/C++
Location: Pittsburgh, PA
Contact:

Re: Is STL a neccisity

Post 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.
MarauderIIC wrote:You know those people that are like "CHECK IT OUT I just made Linux run on this piece of celery [or other random object]!!"? Yeah, that's Falco, but with ES.
Dear god, they actually ported ES to a piece of celery!
Martin Golding wrote: "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: Is STL a neccisity

Post 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
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Is STL a neccisity

Post 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.
dream_coder
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 34
Joined: Sat Mar 27, 2010 5:16 pm

Re: Is STL a neccisity

Post 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.
Image
Image
Image
Post Reply