From the course: Learning SOLID Programming Principles
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Testing consequences - Python Tutorial
From the course: Learning SOLID Programming Principles
Testing consequences
- [Instructor] One of the most important consequences of the dependency inversion principle is the suggestion that a good design permits replacing an application object with a mock object. Python's duck typing makes it very easy to replace an object with a mock object, and this makes it easier to test a class in isolation, by mocking all the collaborator objects. A design that does not follow the dependency inversion principle will often be more difficult to test. It can be difficult to inject required mock objects. Test-driven development is an important guiding principle. In effect, a feature without a test case does not exist. Unwise to use a feature that doesn't have a fully automated test. Ideally, developers can write a test case and then write code so that the test now passes. Then if necessary, they can refactor the working code to improve other nonfunctional requirements like performance or memory use. It's hard to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.