Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

Reinventing the wheel

i have heard this many times ...... " About Reinveting The Wheel "

dont use linklists and arrays , insted use the STL

dont try to build an Operating System it will never be widely accepted ( which is true of course)

but isnt creating your own datastructures an excellent programming practice. i have read that one way of using the STL is to enhance it. the only way i know i can enhance it is by getting a good working knowledge of basic data structures and only way i can do that is by creating my own.

lets see what u guys have to say about it .......
2 Solutions
Yeah I would agree with you that building your own data structures is "excellent programming practice", but that is all it is.  Practice.  If you have a deadline for a project that you are working on, and desperately need some efficient, resizable data structure (say), would you waste time writing your own one, or would you use the STL ?

You can enhance the STL to some extent by deriving your own classes from it if required.  This may prove beneifical, depending on what you are trying to do.  I have never come across a need for this however.

As you get more experienced you will know when to use your own code against using something that already exists.

It boils down to "Putting what you know into practice" (using whatever means you know of to solve a problem) or "practising what you dont fully know" (which could be writing your own code, or could be using someone else's just to gain experience in it).

It can be a hard decision.

Often the only way is to try the already-existing framework and see if it does what you need, and does it in an efficient enough way.

But quite often you end up fighting the tool, to the point where it's more of a hindrance than a help.

A good example is: using a shell script instead of writing a program.

You can often combine a few calls to grep and awk and Perl to do something in ten lines of shell script, that would take hundreds of lines of C++ code.  That's fine, but the script may be too slow, or too flaky, or have too many unwanted side-effects.  Then it may be time to start over using another approach.  

Or maybe the canned approach is to big or too slow.  Oftent the onlly way to find out is to try the high-level approach.  Sometimes the results are really miserable.  Sometimes they're quite usable.  Sometimes you just happen to find the perfect match and the canned code runs very quickly and smoothly.   That's why I'm always pissed when the boss asks "When is it going to be done"?     Might be done in 5 minutes, or we may have to start over and take another month.

You'll probably know when this is-- it's when you are cursing more at the "helper" code than you are making progress.  

I agree generally with the other posts. If you have the time you will learn a lot by doing it yourself. In the real world, however....
furqanchandioAuthor Commented:
how can equally distrubute points here ??
Heh, you can't.  

And I for one am not going to quibble over 20 points; the important thing is you got the info you were after :)

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now