Is it a good rule of thumb to always write code for the intent of re-using it somewhere down the road?  Or, depending on the size of the component you are writing, is it better practice to design it for re-use when it makes sense with regards to time spent on it.  What is a good rule of thumb for spending extra time on analysis and design on project components that have "some probability" of being needed later down the road for other things that may or may need this part.

For example, if I have the need for project X to do things A, and B.  A definitely needs to be written for re-use because it just makes sense to do so.  B is very project specific at the moment, and I can hack it all together in a couple days to finish the project on time and give everyone kudos for being a great team, etc.  Or if we say, lets spend a whole friggin' 2 weeks figuring out what project Y/Z might need this thing for and spend a load of extra time on on part B because someday we might need to use it on project Y/Z (where the savings will be realized).

I'd imagine a perfect world situation would be a nicely crafted combination of project specific vs. re-use architected components given the project.  However some code shops might feel it would be a great idea to write everything for the intention of using it at some point down the road.

Obligatory XKCD #974:

          

In my experience, trying to always make everything reusable may lead to over-engineering. 

However, a certain non-excessive amount of effort to make things reusable is always worth trying to put into things, (when things are amenable to reusability,) because a reusable component is a general purpose component, which means that its interface is abstracted, which means that it is easier to understand it on its own, and figure out how it works and why it works, and what it does and how it does it, when you look at it on its own, or when you look at it 6 months down the road and you don't even remember ever having written it. And these benefits are of course in addition to the fact that it is reusable.

So, to cut a long story short, I believe that the rule of thumb should be:

Make it reusable if doing so will make its interface and / or its implementation easier to understand.
