(Not) Diving In
Explore the fundamentals of unit testing in Python by developing and testing functions that convert numbers to Roman numerals. This lesson guides you through writing tests before code, emphasizing discipline and reliability in programming. You'll learn how test-driven development can improve code quality and maintainability, applying these concepts in a practical coding example.
We'll cover the following...
Kids today. So spoiled by these fast computers and fancy “dynamic” languages. Write first, ship second, debug third (if ever). In my day, we had discipline. Discipline, I say! We had to write programs by hand, on paper, and feed them to the computer on punchcards. And we liked it!
In this chapter, you’re going to write and debug a set of utility functions to convert to and from Roman numerals. You saw the mechanics of constructing and validating Roman numerals in “Case study: roman numerals”. Now step back and consider what it would take to expand that into a two-way utility.