Stability and genericity in dynamical systems