Ever since Laura Thomson wrote her first program in the fourth grade, coding has been a major part of her life. Over the years, she has been a lecturer in computer science at RMIT University in Australia, a principal at OmnTI, a consulting company that designs Internet systems, a trainer of other programmers, the co-writer of PHP and MySQL Web Development and MySQL Tutorial, and a frequent speaker at free and open source conferences. She is currently a senior software engineer at the Mozilla Corporation, where her recent work includes the API for the Add-ons Manager on Firefox 3. With this background, Thomson has strong views on coding, its future, and its place in business, especially where free and open source software (FOSS) is concerned, which she shared with Linux.com at the recent Open Web Vancouver conference.
Thomson was at the conference to deliver her "Write Beautiful Code" presentation. Dismissing clever code as likely to be either buggy or not understood, the presentation lists what Thomson views as the characteristics of the best code. For her, the best code is not only simple and functional, but keeps doing its job even when problems happen. Should it fail, it should do so gracefully and recover. In addition, it incorporates security into its design, instead of following the common practice of making security an afterthought, and is both scalable and performant -- that is, able to cope with a change in load and currently functional. Her answer to what makes a good programmer? "The ability to trust empirical evidence over instinct."
Learning to code
The views expressed in the presentation are based on Thomson's analysis of her own mistakes, and her experience as an instructor and senior software engineer watching others. For Thomson, coding is a communal activity -- which is one reason she is an advocate for free software. "If you code in isolation, you'll make mistakes," she says. "It's not usually until you start working with other people, or start working with open source projects, that you start to think, 'That's really awful code,' and 'That's really good code, and I'm going to code more like this, and less like that.'"
As someone with a long history of teaching others, one of Thomson's concerns for the next generation of coders is whether they will learn enough of the basics to become good at their work. Referencing WhytheLucky, a programmer best known for his cartoon tutorial about how to program in Ruby, Thomson says, "He wrote an essay which is called 'The Little Programmers Lament' in which he says that when people our age were kids, they had the Commodore64 or Apple IIe. Now, kids have an Xbox, and it's not really accessible to programmers. You'll need an SDK, and it's going to cost you money. So the question is, are we bringing up programmers? Are we going to get a next generation that knows how to program? There are many less people now who know C than there were 10 or 15 years ago.
"That's really a source of concern, because you need people who know how to build the fundamentals. The thing I find with people who don't have fundamentals is that they think they can do anything. They don't realize that there are some things that are not possible, or some things that, if you take an unthinking approach to them, it's going to be really, really unfortunate. It doesn't matter how special your mother thinks you are."
In this situation she sees FOSS as potentially helpful. "One of the best things about open source software," she says, "is that, if you want to know how something works, you can go find out. So open source makes for better programmers in a lot of ways."
She believes FOSS developers' habit of reading code also helps them to function more efficiently than many programmers in a team setting. "It's a really important skill to have, to be able to understand other people's code, not just from the point of view of open source, but from the point of being able to work on almost any project. You need to understand how other people think so that you can work with them."
In addition, Thomson views FOSS as a valuable teaching tool that can give students hands-on experience. As an example, she points to a joint effort between Seneca College and Mozilla in which students write add-ons and other contributions to Firefox, so that they can learn from real-world experience instead of academic exercises.
FOSS and the workplace
In the workplace, Thomson says, FOSS developers face the same problems as any developers. The difference, she says, is that "open source people are louder" in their reactions -- perhaps more articulate, more extreme in their views, or aware of their own worth.
One of the main problems that Thomson identifies in the workplace is the division between those who view programming as a vocation, and those for whom it is simply a job. In other words, she says, those who "got into it for the same reason that other people became doctors, not because they want to help people, but for the money. And I don't know whether the solution is just to say that we need a lot of people who are willing to do the boring programming." However, for herself, "I try really hard not to work with people who think it's a nine-to-five job. The good thing about working at Mozilla is that I have so much enthusiasm around me."
Another problem for programmers in the workplace is a general lack of misunderstanding about how to work with them and keep them productive. "A guaranteed way to make programmers unhappy is to have them work 18 hours every day. Nobody minds a crunch, where you have a month where you are going to be away from home for 18 hours, but every day of your working life? It gets old."
"It's all about treating programmers with respect," Thomson says. "I know of one organization where they order small desks, so they can cram more programmers in. It's like a sweatshop. Or often, in companies that have [non-software] products, the sales people are viewed as bringing in income and the programmers -- what do they do?"
Thomson observes that such attitudes are less common within the software industry than in other areas of business. That is why she says, "As a programmer, I would always rather work for a company whose main thing is IT. Because whether it's a software company or a Web company, or one that does databases, it's better to be central to the company than peripheral, like you are if you're an IT administrator for an insurance company. Because, if what you do is the company's core business, then you are going to be treated better."
Even better than an IT company, Thomson suggests, is one with a FOSS business model. In such companies, there is more likely to be a career path for programmers, rather than a switch from coding to managerial work.
"More traditional companies get this wrong," she says. "You know the Peter Principle? It means promoting somebody until they become incompetent. And what that means is, you take your best programmer and you make sure that they never write code again.
"On the other hand, if you have a programmer doing the same thing every day, they're going to get bored and leave. So how do you solve this? The right answer is to have a career path that they can take where they get to architect things, where they have a lot of autonomy -- autonomy being another thing that makes programmers really happy. They like control and knowing they're going to be responsible for what they deliver. And if they're not, it can get incredibly demeaning and depressing for them. And I think that open source organizations are better about having a career path to architect."
A community of the weird
But perhaps the largest reason for Thomson's preference for a FOSS work place is the community's tolerance of differences.
"The open source community is really accepting of weird people," she says. "They don't care why you're weird. It may be you're weird because you're female, it might be because you have long hair or Tourette's [Syndrome] -- whatever it is, people fit in and belong. It's a pretty accepting environment."