Sandia LabNews

‘Agile Manifesto’ co-author launches clean code training at Sandia

Robert C. Martin enthusiastically talks to a rapt audience
UNCLE BOB PREACHES — Robert C. Martin enthusiastically talks to a rapt audience of Sandia programmers about the importance of clean code and how software affects daily life. Martin, known as Uncle Bob, is a co-author of groundbreaking books about creating better software. Martin recently gave nine talks over two days at Sandia.

Brittle code. Code rigidity. Code fragility.

Such is the potential fate of programming code when it is too complex, too inflexible or too fragile to withstand changes or upgrades, at least not without investing significant time and effort.

In contrast, “clean code” is software code that is simple, easy to read and understand and easy to change, both by the author or someone else. Code, like the design and architecture of a system, should improve with time. Code should not “rot” — slowly degrade in performance, said well-known software developer, author and instructor Robert C. Martin at Sandia’s recent Clean Code Kickoff.

“There’s only one thing that stops rot and that’s you doing a good job,” Martin said. “The code doesn’t rot by itself.”

Speaking to an audience at the Steve Schiff Auditorium and other Sandia sites via videostream, Martin gave nine talks over two days to launch the availability through the TEDS training site of Clean Code training videos.

Known in the industry as Uncle Bob, Martin is one of the co-authors of The Agile Manifesto, written in 2001 by a group of thought leaders seeking to encourage better ways of developing software. The manifesto is the foundation of the agile movement, which has spread to numerous areas beyond software because of its ability to help organizations cope with continuous change.

Martin has written numerous articles and books, including “Clean Code: A Handbook of Agile Software Craftsmanship,” which focuses on the best practice of cleaning code “on the fly.” The topics of his talks at Sandia ranged from “The Three Laws of Test Driven Development” and “The S.O.L.I.D. Principles of OO and Agile Design” to “Object Oriented Design Quality Metrics” and “The Programmer’s Oath.”

With great power comes great responsibility

Bob Martin speaks to a live audience at Sandia
WRANGLING WITH ROT — Martin told Sandia, “We rule the world,” because programmers “write the rules that run in the machines that govern everything.”

In his opening talk, “Demanding Technical Excellence and Professionalism,” Martin made the case that software developers have tremendous responsibility because of how pervasive and critical software is in our daily lives. He recounted several examples where problems with software had catastrophic consequences.

In the recent Volkswagen emissions scandal, the company developed and installed software in millions of so-called “clean diesel” cars that was designed to cheat U.S. emissions tests. The exhaust control equipment had been programmed to shut off once the cars left regulators’ test beds, releasing pollutants into the atmosphere that exceeded legal limits. Some former employees are now in prison, and Volkswagen has agreed to pay back more than $20 billion to states, dealers, regulators and car owners.

In another example, a software glitch in trading firm Knight Capital’s computers caused it to rapidly buy and sell millions of shares in minutes rather than over what was supposed to be a period of days. The company lost about $440 million in less than an hour.

“What I’m trying to impress upon you is this: Little did we know how important software was going to be. We did not realize that software would be everywhere,” said Martin, who has been a programmer since 1970. “We rule the world. Other people think they rule the world but then they hand those rules to us, and we write the rules that run in the machines that govern everything.”

Software exists to control hardware

The purpose of software is so the behavior of machines (hardware) can be easily changed, he said. “If your software makes the behavior hard to change, your software thwarts the very reason that software exists.”

Making software easy to change is dependent on following design and testing principles, Martin said. “When software gets hard to change, it’s because principles have been abandoned,” he said. Code should improve with time, not degrade.

Martin outlined a list of expectations for the programmer audience, including a steady release of features that work at the end of each cycle, honest estimates of time required for projects, consistent turnaround times, inexpensive adaptability and continuous learning.

Importance of clean code to Sandia

In his introductory remarks, director John Zepper said he’s seen Sandia teams get bogged down with “legacy ball-and-chain code.” Since code is rarely written once and forgotten, writing clean code from the outset is vital, especially when team members change. Code that is easy to understand and change makes it easier for a new person to step in.

“When developers write clean code, they’re helping their future selves and co-workers,” John said.

Clean code also reduces the cost of maintenance

At Sandia, some software teams spend half of their time on maintenance, said manager Manoj Bhardwaj. By applying Martin’s principles, one team, using clean code principles over the past few years, has reduced maintenance costs to less than 10 percent, which translates to savings of millions of dollars over many years just for one team.

“As more and more teams apply these principles and deliver sustainable code, the potential savings Labswide could be in the tens of millions,” Manoj said.