Here is a good and simple library, why write another?
http://bildr.org/2011/08/74hc595-breakout-arduino/