Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the talk titled 'Testing Randomness' presented by Jakub Rodzik at the wroc_love.rb 2023 event, the speaker explores the challenges faced when testing for randomness in software development. The central narrative follows a character named Fredo, who is tasked with creating a simple game involving dice rolls for two players. The purpose of this adventure is to illustrate the importance of implementing proper testing practices, particularly Test-Driven Development (TDD). The presentation is structured around key points that demonstrate both the practicalities and pitfalls of testing randomness. **Key Points:** - **Introduction of the Hero:** The story introduces Fredo, a developer faced with the challenge of building a game that returns a winner based on dice rolls, setting the stage for his programming journey. - **TDD Focus:** Fredo starts his development with tests, adhering to TDD principles, to validate the game's logic before implementation. He first writes tests to ensure the game can correctly determine a winner. - **Challenges with Randomness:** The narrative highlights the complications of testing scenarios that rely on randomness. When new requirements (like handling ties) are added, Fredo discovers that the randomness makes it challenging to validate outcomes with certainty. - **Introduction of Mocks/Stubs:** To overcome testing obstacles, Fredo's fellow developers suggest using mocks and stubs, allowing the testing of all game scenarios without relying on true randomness, emphasizing that predictable outputs lead to reliable tests. - **Refactoring for Better Design:** The talk illustrates the application of SOLID principles, specifically the Open/Closed Principle, and introduces abstractions like a Die class to improve code structure. This allows different types of dice to be implemented without altering existing tests. - **Event Logging for Transparency:** To address customer feedback regarding game outcomes, the presentation simplifies tracking events in the game, providing logs that detailed the gameplay and outcomes. - **Final Conclusions on Testing Randomness:** The talk concludes by advising against testing randomness directly. Instead, Rodzik suggests extracting randomness where possible and controlling it to ensure reliable outcomes in tests. With these insights into Fredo's journey, Jakub Rodzik effectively conveys the complexities of testing randomness in software and reinforces the importance of structured testing methodologies and code design principles.
Suggest modifications
Cancel