Changes for page Testable Design
Last modified by chrisby on 2024/09/19 10:50
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -2,7 +2,7 @@ 2 2 3 3 === Core aspects === 4 4 5 -* **Object-Oriented**: Althoughboth procedural and functional programming paradigmssupporttesting,managingtestcomplexity canbecome a challengeasthe systemscales. As complexity increases,maintainingtestisolation becomesmore difficult.Anffectivestrategy is tose object-orientedtechniques thatencapsulate complex logicwithin hierarchiesof classes,creatingtestableunits thathidetheirinternalcomplexity behindinterfaces.Wrapping procedural or functional code in classescan combine thestrengths ofseveral paradigms.Any code base that reaches a certain level of complexitycanbenefit froman object-oriented approach toimprove testability.5 +* **Object-Oriented**: While both procedural and functional programming paradigms can be tested, they often face a scalability problem. As the complexity of the system increases, testing isolated segments of code becomes increasingly difficult. One solution is to encapsulate this complex logic in an object-oriented hierarchy of classes. These classes can encapsulate the code and its associated complexity behind dependencies, creating isolated units that can be easily tested. The same procedural or functional code can easily be wrapped in classes, allowing to combine the benefits of all programming paradigms. It's worth noting that for any code base that reaches a certain level of complexity, adopting an object-oriented approach can significantly improve its testability. 6 6 * **Classes implement interfaces**: The class implements a well-designed interface, just as large as necessary to satisfy its requirements. 7 7 * **Tests run against interfaces**, so the implementations details are not relevant as long as the results are correct. 8 8 * **Minimal number of dependencies** in a unit for low complexity.