I also consider stack sizes when I overbet, and that is rarely. First, as LD1977 said, you need to have a strong hand. Won't win all the time, but it will most of the time. Second, if I have a pretty good sized stack and the villain has almost pot-committed himself, I will usually overbet to get him to put it all in.
Think about it...if he folds, then that is a HUGE mistake on his part because he is already almost pot-committed (or in some cases, already is). If he calls, your strong hand will more often than not hold up against him.
Win-win, no matter the outcome. Even if you lose the hand, you still made the right decision, and that is what's important in the long run.