A good training, and enough walking and playing to release their energy (this is a major requirement).
But unfortunately they are bred to much (including incest) that defects can accrue which leads to psychological problems down their bloodline. Breeders only doing it for the money at the expense of dogs life quality (hell too them! greedy monsters). And people merely choosing this breed for protection or toughness.
Plus they are incredible strong, so an attack can be be fatal when compared to hyperactive Chihuahua.
We had a rottweiler who couldn't do any harm, nicest dog you would encounter and then after he died we got another one, which was quite the complete opposite.