The Productive Programmer
Neal Ford
Neal Ford
Copyright 2009 Neal Ford
OReilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (.
The OReilly logo is a registered trademark of OReilly Media, Inc. and related trade dress are trademarks of OReilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and OReilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.
This book uses RepKover, a durable and flexible lay-flat binding.
O'Reilly Media
Foreword
David CodeSherpas Bock
Principal Consultant
CodeSherpas
The individual productivity of programmers varies widely in our industry. What most of us might be able to get done in a week, some are able to get done in a day. Why is that? The short answer concerns mastery of the tools developers have at their disposal. The long answer is about the real awareness of the tools capabilities and mastery of the thought process for using them. The truth lies somewhere between a methodology and a philosophy, and that is what Neal captures in this book.
The seeds of this book were planted in the fall of 2005, on a ride back to the airport. Neal asked me, Do you think the world needs another book on regular expressions? From there, the conversation turned to topics of books we wished existed. I thought back to a point in my career where I feel I made the leap from merely good to very productive, and how and why that happened. I said, I dont know what the title of the book is, but the subtitle would be using the command line as an integrated development environment. At the time I credited my increased productivity to the acceleration I experienced using the bash shell, but it was more than thatit was my increasing familiarity with that tool as I stopped having to struggle to do things and could just get them done. We spent some time discussing that hyperproductivity and how to bottle it. Several years, untold conversations, and a series of lectures later, Neal has produced a definitive work on the subject.
In his book Programming Perl (OReilly), Larry Wall describes the three virtues of a programmer as laziness, impatience, and hubris. Laziness, because you will expend effort to reduce the amount of overall work necessary. Impatience, because it will anger you if you are wasting time doing something the computer could do faster for you. And hubris, because excessive pride will make you write programs that other people wont say bad things about. This book doesnt use any of those words (and I used grep to check), but as you read on, you will find this sentiment echoed and expanded in this content.
There are several books that have had a great influence on my career, changing the way I see the world. I wish I had this book in hand 10 years ago; Im sure it will have a profound influence on those who read it.
Preface
Many years ago, I taught training classes for experienced developers who were learning new technologies (like Java). The disparity between the productivity of the students always struck me: some were orders of magnitude more effective. And I dont mean in the tool they were using: I mean in their general interaction with the computer. I used to make a joke to a few of my colleagues that some of the people in the class werent running their computers, they were walking them. Following a logical conclusion, that made me question my own productivity. Am I getting the most efficient use out of the computer Im running (or walking)?
Fast-forward years later, and David Bock and I got into a conversation about this very thing. Many of our younger coworkers never really used command-line tools, and didnt understand how they could possibly offer more productivity than the elaborate IDEs of today. As David recounts in the foreword to this book, we chatted about this and decided to write a book about using the command line more effectively. We contacted a publisher, and started gathering all the command-line voodoo we could find from friends and coworkers.
Then, several things happened. David started his own consulting company, and he and his wife had their first children: triplets! Well, David now clearly has more on his hands than he can handle. At the same time, I was coming to the conclusion that a book purely about command-line tricks would be perhaps the most boring book ever written. At about that time, I was working on a project in Bangalore, and my pair-programmer partner, Mujir, was talking about code patterns and how to identify them. It hit me like a ton of bricks. I had been seeing patterns in all the recipes Id been gathering. Instead of a massive collection of command-line tricks, the conversation should be about identifying what makes developers more productive. Thats what you hold in your hands right now.
Who This Book Is For
This isnt a book for end users who want to use their computers more effectively. Its a book about programmer productivity, which means I can make a lot of assumptions about the audience. Developers are the ultimate power users, so I dont spend a lot of time on basic stuff. A tech-savvy user should certainly learn something (especially in ), but the target remains developers.
There is no explicit order to this book, so feel free to wander around as you like or read it front to back. The only connections between the topics appear in unexpected ways, so reading it front to back may have a slight advantage, but not enough to suggest thats the only way to consume this book.
Conventions Used in This Book
The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.
Using Code Examples
This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless youre reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from OReilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your products documentation does require permission.