Test-Driven Development (TDD) in Python #4 - Duplication & The Rule of Three

preview_player
Показать описание
Jason Gorman demonstrates how and when to remove duplication from our solution and test code, how duplication can signpost a better design, and when to leave duplication in

Рекомендации по теме
Комментарии
Автор

Just started watching your series (diary and Python to begin). Very educative videos, thank you for your efforts in explaining the concepts and providing examples in several languages!

I'd like to hear your considerations for the frozen dataclass. My (naive?) initial thought was that there is only one rover, which changes its status as it goes. In that line of thought I would implement an object that can be directed to move and subsequently changes its internal state to reflect its new position. You would then update the current object (call `rover.go('R')`) rather than create a new object and update the reference (declare `rover = rover.go('R')`). There are probably benefits in either implementation from the perspective of e.g. the user, the tester and/or the developer. There may also be some (negligible?) speed / memory considerations. I'd love to hear your thoughts on this!

bartman
Автор

I would like to see this applied to data structures. I'm practicing TDD using data structures because I'm currently studying data structures and algorithms. I'm curious to how you would approach it.

joshuamarcano