> write the same code for the Nth time

who does this though ? maybe you should extract that into a library/method/abstraction ?