Depends entirely on the anime. There is no golden, universal, length for an anime series.
Typically speaking, I prefer the few ShÅnen anime I've been known to watch to be shorter because throughout the years, almost all of them have been filled with well... fillers, fodder. It is ridiculous and adds nothing to the substance of the anime except as an excuse to keep filling their wallets because young children are easily entertained at that age.
While on the other side, a good slice-of-life or romance anime can keep me invested longer those series usually run. Particularly those by Key - Air, Kanon, Clannad, etc... all of those could have ran for longer and I would have kept watching.