in reply to To USE or not to USE
"We should forget about small efficiencies, about 97% of the time. Premature optimization is the root of all evil."
-- Donald Knuth
Your time as a programmer is very valuable, and if you're spending a substantial time re-inventing the wheel, you're not allocating your time optimally, either from your own perspective, your employer, or the community at large. If some library is broken, or inadquate, by all means create a better wheel, but make sure that your efforts are not gratuitous.
I used to fall into this trap all the time, but I eventually realized the futility of it. Oft times a library that you can import from elsewhere will have already hashed out all of the subtleties and painfully slogged through the pitfalls. Stand on the shoulders of the creators instead of reliving their travails.
Take care of the big picture first, and don't get bogged down in the minutia. Not only may you gain minimal performace boost, but your code may not even be functionally correct if it is a complex problem. You might not even fully comprehend the comlexity of the problem. For evidence of this, look no farther than the regex required to properly and exhaustively validate email addresses.
Later in the project, when you've got your functionality down pat, shift your attention to the internals, going back and sussing out the bottlenecks. If you can isolate a particular library as a drag on your throughput, then and only then go to the trouble to rewrite it yourself.
|
|---|