Some excursions can sell out quicker than others, and if you wait until the cruise starts to book them onboard they may be sold out. Thus booking them before the cruise can make sense.
For first time cruisers I usually suggest they go with the tours offered by the cruise line, especially if it is in a place you have never visited before. The cruise line tours will 'hold your hand' throughout and you'll have peace of mind that you won't miss the ship if the tour is late, etc. However, you can usually get the same tour for less money if you book them independently with an excursion operator. It really depends on how comfortable you feel about booking something outside of the control of the cruise line. Shoretrips.com is a reputable company that many travel professionals use.