I find myself constantly running into this expression "don't reinvent the wheel" or "never reinvent the wheel" when I ask some questions on SO.  They tell you to use some frameworks or existing packages.  I know where this attitude is coming from since it's unwise to waste time on something others have already solved.  Or it that so?

As a student,  I find by using some code others wrote to solve my problem I can't learn as much as I'd like to, and I gain less insight.  And sometimes I think that phrase is mainly for working programmers facing deadlines and not for students like me.

Is it that bad to "reinvent the wheel"?  Maybe I'm thinking it wrong? Maybe there is a way I can avoid reinventing the wheel and at the same time learn a lot?

I think you make a good point. Most of the programmers on this site are likely working professionals whose goal is pretty much to create quality software as quickly as possible. Reinventing the wheel fails this goal on two counts.


Re-writing code that exists is wasted effort that could be used on the unique parts of your system and makes the project take longer than is necessary.  
The first version of any code is more likely to have bugs/unforseen issues. Most libraries and re-usable components have been battle tested and patched multiple times. If you re-invent a hashing algorithm or try to create your own RDBMS (unless that is what the project is) more often than not you are going to end up with inferior results.


That said, in an academic environment the goal is to learn, not deliver software on a budget. Re-inventing a wheel to understand how the spokes or axle work is a great way to accomplish that goal. That's why many programming curricula include a class on building compilers when very few working programmers ever have cause to need to do that.
