As a general rule I prefer not to ride on the sidewalk for a number of reasons.
The first primary rule against that here in Tucson, AZ it's illegal to ride on sidewalks. Secondly, I will ride on sidewalks only if it's not safe to ride in a roadway. There is a section of Tucson where there is virtually no space for motor vehicles and bicycles at the same time . I could legally "take the lane" but during periods of traffic congestion I would rather ride on the sidewalk and risk a fine.
Again, it all depends on the area of time I'm riding, traffic congestion and the amount of pedestrians on the sidewalk.