I was reading about the USS Pampalino(sp?) on display in San Francisco, CA. Since I live about an hour away, I am planning on dragging my girlfriend with me (Hey, she dragged me to the Titanic exhibit, now we're even

)
While reading the specs of the boat, it mentioned that the propulsion was generated by having 4 Diesels powering generators, which then powered electric motors which in turn rotated the shafts to the screws. I found this interesting- it reminds me of the way a Diesel-electric train functions.
Did most class boats operate like this? and what are the advantages of using a combustion engine to generate electricity to power an electric motor? Sounds like an awful lot of steps just to make a submarine go.