C++'s STL

Yeah, I know, I already complained about it heavily before. I didn't knew a lot about C++ and I rather programmed in C with Classes than in C++ and it's set of libraries. But my decision to open for more did also bring more insight into almost anything related to the languages I already used before. And to get back to STL, I found this very well-explained articel about C++'s Standard Template Library and it opened my eyes with a simple explanaton what it really is about. Before I startd studying informatics, I didn't knew anything about the usefulness different ways to store data except that I knew how to organize arrays and doubly-linked lists. That's fine I thought, wrote my library and that was it. During the first semester I reprogrammed all the typical ways to store data (lists, LIFO, FIFO, etc...) just cause I liked to have them, but actually never used it cause I implemented them using my only doubly-linked list item structure. So I thought there is no difference but less freedom, so I simply forgot about it. But the more I learned, the more I noticed how inconvenient my structures and classes were and how cool id'd to generalize everything. I already did that with threedimensional arrays and their operations, geometric data classes (points, rectangles, polygons later) but I never, really never updated my old classes. They were the first with templates and not so sophisticated like my later technology. But reading this article I see how actually good the idea of STL is. Simply take you organisation class, get the iterator type (great use of definitions inside the class) and simply do element-specific operations. I couldn't design it better! My own doubly-linked list class wasn't really a list, it essentially consist of only one iterator and operations of it. I did a shit-load of operations like inserting lists into, managing lists in endless loops etc... A cool thing, but I hardly used them. I only used the basic operations of adding, removing and clearing etc... And well - that's essentially an iterator for an STL class. I must admit, I simply dropped the idea of learning about when I first saw what weird stuff it did. I didn't knew ANYTHING about it's usefulness and I was busy enough to write routines to draw bitmaps on other bitmaps. That was a good thing - I didn't need any of STL's storage classes (or any data other than a big, dynamically allocated one-dimensional array with custom index formula). I didn't need anything else, but now I do. I think I always limit myself to only the essentials I need to solve one problem or finish a project. I always brainstorm everything to get the essence down and effective as possible. Implementation is another thing and I guess having only my own rather complicated to use classes (yeah I said before they were easier to use, but that was before I understood how the STL worked) prevented me from getting inspired enough to use more dynamic concepts on list base. I work toward my bachelor thesis, although there are still 3,75 semesters left. A lecturer always mentions that there's a specific task about image analysation were he works which's free to take as a bachelor thesis and I think I found a nice solution to the problem involved. Although it uses no single technique he mention during his lectures (image processing/analysation is still a young and yet-to-uncover part of informatics), but that's o I think. Unfortunately, I won't be able to put in some already-known knowledge and technologies about image processing. Ok, I'm studying somewith the word "applied" in front, which doesn't necessarily I'll have to base on too much theory, but required technology.

So anyway, STL is cool, I'll drop my list structures and use them instead. Let's if I can find some other interesting standard libraries, so I can atleast try to see their use. But I doubt will find it useful if I haven't encountered any problem yet. All in all, I begin to learn how to appreciate the stuff I always disliked before. That's only a good thing - it makes my life and understanding of technology and development much easier. And quicker. I won't have to use my rather C-like memory structures anymore! It's always better to research the usage and technology found everywhere, so you can build up on the good ideas of others (if there are any). And the STL is exactly that kind of generalization to support my way to go.

No comments: