Abstract: We study the problem of optimally allocating effort between software development and debugging together with optimally choosing the project duration. This integrated problem is formulated as an optimal control model in which the proportion of effort allocated to development, u(t), is the control. We examine the trade-off between higher system quality (fewer bugs at the end of the project) and longer project duration (higher schedule cost) to find the optimal duration of a software development project. The objective is to deliver a system by incurring the least amount of schedule cost and software error cost. A distinguishing feature of our work is that it minimizes the total cost by considering both external economic cost factors (such as market revenue) and internal factors dealing with software development. The total cost is the sum of the schedule cost and the software error cost. Results show that our approach can yield significant reduction in total cost. Furthermore, our results indicate that loss of market sales can play an equally important role as software quality in ultimately determining whether a software product is a market success of not.