Writing a library is like SGD: Every time you'd like to write some code according to current requirements. However, after some time you probably don't need it any more and the code gets deprecated. After along time, finally you've found the central need and therefore maintain its core.