Modeling Software Defect Dynamics