Until the last time, I learned functions, conditional branching, rake build tools, etc. This time, let's go back to the basics and note what we learned about "test-driven development," which is the essence of Ruby.
For example, when developing large-scale software, you write long and complicated source code, but even a person who is good at programming cannot suddenly write perfect code. At the extreme, if you write 10,000 lines of source code and then compile or run test, you will get errors and exceptions. In this case, the trouble is where the error is and where to fix it. It's a point I don't understand.
This is an extreme example, but in test-driven development, as a rough measure, write the minimum test code for some functions ➡ Fix it because an error occurs ➡ Read while maintaining the error-free state Improved to easy code Repeat these 3 steps.
It checks for errors very frequently, so you can detect bugs early. Engineers often encounter bugs of unknown cause, such as with additional implementations, so this fine error check can prevent such bugs. Another advantage is that it is easy to maintain because the code is easy to read and includes tasks to improve it.
Writing test code takes time anyway, which increases the time burden in the early stages of development. In addition, it is necessary to maintain the code once written. You can't write high-quality test code without getting used to it, and it also takes time to fix it.
It seems that this test-driven development method is good or bad depending on whether it emphasizes accuracy or speed.
https://it-trend.jp/development_tools/article/32-0036#chapter-2
Recommended Posts