The scientific method isn’t only for people in lab coats, surrounded by Bunsen burners and petri dishes, peering into microscopes. It’s for everyone—software developers included.
That was the message delivered by Fastly software engineer Blithe Rocher at our latest New Relic FutureTalk event. Blithe earned her Ph.D. in physical chemistry from the University of Southern California and claims that without the structure of the scientific method she might never have survived those six years of 30-plus daily experiments.
“As a grad student I scientifically tested system after system until I had enough new knowledge to publish a paper,” she says. “Now I’m a full-time Ruby developer, still using the scientific method every day.”
This historic method, which offers a systematic means for gaining and incorporating knowledge, can be incredibly valuable for developers—especially beginning developers, and most definitely when it comes to troubleshooting. Too often, Blithe says, developers head straight to Stack Overflow when they come up against a coding problem. But even if simply grabbing a quick fix from a message board solves the immediate issue, it doesn’t advance your knowledge. Nor does it lower the likelihood that you—or your colleagues—will encounter that same problem again somewhere down the line.
“Science is all about gaining knowledge about the world and sharing it with others,” says Blithe. “I think developers can really learn from this.”
Step 1: Define the problem
This crucial first step involves going beyond merely noting that something is wrong and actually taking the time to delve into the matter. Too often, developers short-circuit their attempts at troubleshooting by rushing to fix an issue as fast as possible—without ever taking the time to understand the problem.
Instead, Blithe encourages a more patient, open-minded approach. Forget what you think you know is going on, and instead take a step back and reflect. What are you expecting to happen? What is actually happening? By asking and answering such questions before you go hunting for a fix, you establish clear criteria for success and give yourself a much better chance of reaching it.
This can be particularly important when you’re helping another developer who’s adamant they know what the problem is—they just can’t seem to fix it. “Ignore their assumptions and preformed conclusions,” Blithe advises. “Start from scratch.” The answer, after all, might be much simpler than you think.
Step 2: Do your research
Beginners should always be learning, building up background knowledge, even when they’re not actually coding. Then, when a problem occurs, they have more information to draw on. Blithe suggests getting to know your environment as well as possible right from the outset. “Before I get started on a new project, I look at all the dependencies of the application,” she says. “I want to know: How do those work? What versions are we using?”
She also reads all the relevant literature she can find, including blog posts, libraries, versions, and changelogs. And when she does encounter a problem, she discusses it—first with the little plastic dinosaur on her desk, then, if necessary, with a friend or colleague. “If you don’t solve something in an hour on your own, it’s time to reach out to someone else who might have information that can help you.”
As an example, Blithe tells a story about a friend who wasted hours writing new code to solve a seemingly complex string interpolation issue, when all that was missing from the existing code was a single pound symbol. If the friend had only asked for help, the problem could have been solved in a matter of seconds.
Blithe’s account of the scientific method included five other key steps:
- Establish a hypothesis
- Design the experiment
- Gather data
- Analyze your results
- Keep a good lab notebook [or logbook]
To learn about these techniques and their applications for software troubleshooting, watch the full FutureTalk video below:
You can also view Blithe’s presentation slides online.
More great FutureTalks to come
For more information about our FutureTalks series, make sure to join our Meetup group, New Relic FutureTalks PDX, and follow us on Twitter @newrelic for the latest developments and updates on upcoming events.