Ruby Study Memo (Test Driven Development)

Overview

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.

What is Test Driven Development?

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.

merit

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.

Demerit

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.

reference

https://it-trend.jp/development_tools/article/32-0036#chapter-2

Recommended Posts

Ruby Study Memo (Test Driven Development)
Ruby study memo (conditional branching)
Ruby study memo (recursive function)
[Ruby ~ Iterative processing ~] Study memo 4
Ruby memo
[wip] Ruby memo
Test Driven Development in Functional Language Elm (Chapter 15-16)
Java development environment memo
[Java ~ Method ~] Study memo (5)
Ruby study notes (puts)
Dot installation study memo 01
[Java ~ Array ~] Study memo 4
Test Driven Development in Functional Language Elm (Chapter 5-7)
Test-driven development in the functional language Elm
Ruby Study Memo (Test Driven Development)
[Ruby on Rails Tutorial] Error in the test in Chapter 3
Building an environment for copying the book "Test Driven Development"
Play Framework Study Memo Database ①
GraphQL Ruby and actual development
Java Silver Study Method Memo
[Self-use memo] (Ruby) class, class instance, instance
Personal memo Progate Ruby I (2)
[Java ~ Boolean value ~] Study memo (2)
Introduction to JUnit (study memo)
Java study memo 2 with Progate
Personal memo Progate Ruby I (1)
Ruby study notes (variables & functions)
[Ruby] REPL-driven development with pry
Spring Security usage memo test
ruby exercise memo I (puts)