Cultivating Quality Code: A Slack Takeover with Jeff Langr
Thought leaders throughout the software community are taking over the TechWell Hub for a day to introduce themselves, answer questions, and engage in conversations.
Jeff Langr is the president and owner of Langr Software Solutions Inc., as well as the author of a number of books about all aspects of software.
@Jeff Langr presided over the most recent Slack takeover, which led to some insightful discussions.
Unit Testing versus End-to-End Testing
“I have heard it said that it is better to write more end-to-end tests than small unit tests, because they are closer to how users would use the software, and therefore can find realistic bugs better. (Many other arguments are given in favor of this practice.) On the other hand, I’ve also heard it said that unit tests are better because they give quicker feedback and therefore able to prevent bugs right at the source. What is your perspective on this topic?” —@Eliel Goco
This is a popular question, so Langr gave pros for each testing method.
- Gives fast feedback
- Is easier to build and maintain
- Pinpoints source of failure
- Is great for verifying that core end-user goals are accomplished
- Confirms you deliver what the customer wants
- Catches costly bugs
“The nice thing is that it’s not a dichotomy--we can put appropriate efforts into each kind of test,” Langr said. He suggested looking at diagrams of the test pyramid to devise a balance.
Improving Code Reviews
“Do you know any code review tool which can help speed up the process of code review?” —@Minu
Langr responded that tools can definitely help, but he’s not a big proponent of either static analysis tools or pull requests as the core mechanism for review.
“If the goal is to get code review done quickly, you can easily get that goal met, but the main point is to ensure solutions were built with quality,” he said.
If the real goal is to find deep problems that will be costly to deal with later and to make sure the changes that need to take place actually occur, he suggests mob programming and pairing with frequent pair-switching.
“Put another way: Code review is a fairly time-consuming process because it probably needs to be,” Langr said.
Agile Testing, TDD, and BDD
“What advice do you have for transitioning a team from testing in an agile (and slightly more disorganized way) over to TDD? I can see the value in TDD but can see it would require a big shift in how we are currently working at the moment.” —@Melissa Peaks
Langr said that his big focus has been on increasing the ROI of test-driven development by ensuring the tests not only help shape design and give confidence, but also provide high-quality documentation on the little intended bits of logic in the system.
Ultimately, he said, it’s in the best interest of everyone to collaborate more frequently.
“In terms of transitioning, getting folks together up front to agree on things might be the hardest hurdle. I would start there if you at all have a way of helping initiate those conversations,” he recommended.