Unit Tests Make Code Worse
// Test driven dev int abs(int x){ if(x==0) return 0; else if(x==1||x==-1) return 1; //Added to pass unit test else if(x==17||x==-17) return 17; //Added to pass unit test else if(x==18||x==-18) return 18; ... } #Programming What are your tips for writing clean code? Wrong answers only. #100DaysOfCode
A social media post shows a programmer’s absolute-value function cluttered with special cases added solely to pass unit tests, followed by a prompt asking for tips on writing clean code and requesting only wrong answers. The joke mocks test-driven development when developers hack in arbitrary exceptions instead of implementing the general solution, and is sent as a relatable programming reaction. EN: A social media post shows a programmer’s absolute-value function cluttered with special cases added solely to pass unit tests, followed by a prompt asking for tips on writing clean code and requesting only wrong answers. The joke mocks test-driven development when developers hack in arbitrary exceptions instead of implementing the general solution, and is sent as a relatable programming reaction.
- @ithueti / 2960 2020-10-19
- Type
- image
- Size
- 800×678 · 54.0 KiB
- Mood
- саркастичный, абсурдный
- Language
- en
- Added