Tag Archives: coding

Letting Go of the Chainsaw: Lessons from Firefighters for Software Engineers

I am reading this excellent book called Range, and I just went through an interesting chapter where the author reports some studies that were looking at why some firefighters die trying to outrun a fire while carrying heavy chainsaws, axes and other equipment. Should they have dropped those, they would have survived.

Emotional Attachment to Tools

One possible explanation is that their tools are so intrinsically linked to their identity as firefighters that they become almost like an extra limb on a subconscious level. People don’t realize those tools are not part of their being and can be dropped.

The book mentions one firefighter who noticed what was happening and knew he had to throw away his saw but felt compelled to carefully put it down – while trying to escape a ravaging fire. Still, he pushed the feeling aside, dropped his saw and survived.

The Sunk Cost Fallacy

When reflecting on this, the sunk cost fallacy also came to mind, which is “the phenomenon whereby a person is reluctant to abandon a strategy or course of action because they have invested heavily in it, even when it is clear that abandonment would be more beneficial.”

Letting Go of Past Investments

We can draw some valuable lessons from those examples in software engineering and operations. For instance, many people may feel emotionally attached to the tools, frameworks, and programming languages they have used throughout their careers. This attachment can be so strong that they become resistant to change, even when it’s evident that adopting new and more efficient technologies would yield better results.

Engineers may also hesitate to switch to a new technology or platform, fearing that the time and effort spent learning and working with their current tools would go to waste. However, it’s essential to recognize that technology is constantly evolving, and what was once cutting-edge may now be outdated. In these cases, it’s crucial to let go of past investments and focus on adopting new solutions to deliver better outcomes.

To succeed and keep improving, we need to be adaptable. Just as the firefighter who survived realized he had to drop his chainsaw, software engineers should be open to discarding tools or practices that may be hindering their progress or efficiency. It might be challenging to let go of something integral to your work, but doing so can open up new opportunities for growth and success.

Fostering Improvement

In team management and collaboration, fostering a culture that values continuous learning and improvement is essential. Encourage team members to explore new tools, frameworks, and methodologies to help the team become more efficient and deliver higher-quality software. By creating an environment where individuals feel supported in their pursuit of growth, you’ll be better equipped to handle the ever-changing landscape of software development.

Lastly, communication is vital when applying these lessons to your teams. Make it a point to regularly discuss new technologies, trends, and best practices with your team. 

Conclusion

Encourage open conversations about the tools and processes currently in place, and be willing to make adjustments if they no longer serve the team’s best interests. By fostering a culture of transparency and adaptability, you can help your team thrive in an ever-changing industry and drive continued success.

Shift Left

Note: This article was originally written for my blog in Portuguese back in 2021.

Shift Left is a practice in software development where the aim is to find defects as early in the process as possible. A study from NIST shows that the cost of finding and fixing defects increases exponentially the farther it is found in the development cycle. Therefore, the ideal scenario is to find defects as early as possible, ideally in the design phase.

As a DevOps professional, a large part of my work has been focused on code quality in our business unit, which primarily develops code for embedded systems, FPGAs, industrial automation, and industrial robot controllers. Given the nature of our products, the cost of developing high-quality code is immense, and each release cycle is exceptionally long.

To solve these problems, our team has been working to implement a Shift Left approach by following these steps:

Writing Unit Tests Concurrently with Code

Writing unit tests concurrently with the code is the most critical part of Shift Left. Developers should not wait for the next phase, testing, to see if there are any obvious bugs in the code. Instead, most testing should be done in the implementation phase through unit tests that must be run constantly. This also helps ease the test team’s workload and lets them focus on more important things than testing the basics.

Code Review

The next step is code review. Developers should create a branch, write the code (including tests), and send it for review instead of merging it directly into the trunk. Code review allows for the early detection of bugs and can prevent these issues from propagating to later stages of development, saving time and resources. Code review allows developers to learn from one another and share best practices, resulting in better code quality and more effective teamwork, again addressing them on the left. See Google’s best practices for code review.

Pre-Commit

Human beings don’t like to have their work criticized, so pre-commit hooks can reduce criticism’s human element. Using pre-commit, a bunch of tests can be pre-programmed to run in the code about to be committed. Linters, tools that check for leaking secrets, styling tools, and others can be used. Pre-commit does not allow code to be pushed if it does not pass QA on the developer’s machine. It ensures that the basics are covered before the code goes into review.

Text Editor and Plugins

The text editor/IDE that the developer uses is as far left as possible. Developers can use various plugins and tools to improve the code. For instance, Microsoft Visual Studio Code is an excellent editor with many useful plugins, including language servers, linters, and AI-based plugins like Co-pilot, Sourcery and TabNine. Sonarlint, a Sonarqube plugin, can analyze code and display issues as soon as the user saves it.

By following the steps outlined above, software development teams can significantly reduce the number of defects that make it to the testing phase. While no single solution guarantees perfect code, combining the tools and techniques discussed and a strong focus on code quality can help minimize the total project delivery cost and time. For further information on how these steps can help reduce defects and improve the overall quality of code, I strongly recommend reading Steve McConnell’s book Code Complete. Take action today to improve your software development process and achieve better outcomes for your team and business.