ebook img

97 things every programmer should know: collective wisdom from the experts PDF

257 Pages·2010·1.92 MB·english
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview 97 things every programmer should know: collective wisdom from the experts

97 Things Every Programmer Should Know Collective Wisdom from the Experts Edited by Kevlin Henney Beijing · Cambridge · Farnham · Köln · Sebastopol · Taipei · Tokyo 97 Things Every Programmer Should Know Edited by Kevlin Henney Copyright © 2010 Kevlin Henney. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc. 1005 Gravenstein Highway North, Sebastopol CA 95472 O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or [email protected]. Editor: Mike Loukides Compositor: Ron Bilodeau Series Editor: Richard Monson-Haefel Indexer: Julie Hawks Production Editor: Rachel Monaghan Interior Designer: Ron Bilodeau Proofreader: Rachel Monaghan Cover Designers: Mark Paglietti and Susan Thompson Print History: February 2010: First Edition. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. 97 Things Every Programmer Should Know and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are clarified as trademarks. Where those designations appear in this book, and O’Reilly 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 au- thors assume no responsibility for errors and omissions, or for damages resulting from the use of the information contained herein. This book uses Repkover,™ a durable and flexible lay-flat binding. ISBN: 978-0-596-80948-5 [SB] To absent friends Contents Contributions by Category . . . . . . . . . . . . . . . . . . . . . xv Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii Act with Prudence . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Seb Rose Apply Functional Programming Principles . . . . . . . . . . . . 4 Edward Garson Ask, “What Would the User Do?” (You Are Not the User) . . 6 Giles Colborne Automate Your Coding Standard . . . . . . . . . . . . . . . . . . 8 Filip van Laenen Beauty Is in Simplicity . . . . . . . . . . . . . . . . . . . . . . . . 10 Jørn Ølmheim Before You Refactor . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Rajith Attapattu Beware the Share . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Udi Dahan v The Boy Scout Rule . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Robert C. Martin (Uncle Bob) Check Your Code First Before Looking to Blame Others . . . 18 Allan Kelly Choose Your Tools with Care . . . . . . . . . . . . . . . . . . . 20 Giovanni Asproni Code in the Language of the Domain . . . . . . . . . . . . . . 22 Dan North Code Is Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Ryan Brush Code Layout Matters . . . . . . . . . . . . . . . . . . . . . . . . . 26 Steve Freeman Code Reviews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Mattias Karlsson Coding with Reason . . . . . . . . . . . . . . . . . . . . . . . . . 30 Yechiel Kimchi A Comment on Comments . . . . . . . . . . . . . . . . . . . . . 32 Cal Evans Comment Only What the Code Cannot Say . . . . . . . . . . 34 Kevlin Henney Continuous Learning . . . . . . . . . . . . . . . . . . . . . . . . . 36 Clint Shank Convenience Is Not an -ility . . . . . . . . . . . . . . . . . . . . 38 Gregor Hohpe vi Contents Deploy Early and Often . . . . . . . . . . . . . . . . . . . . . . . 40 Steve Berczuk Distinguish Business Exceptions from Technical . . . . . . . 42 Dan Bergh Johnsson Do Lots of Deliberate Practice. . . . . . . . . . . . . . . . . . . 44 Jon Jagger Domain-Specific Languages . . . . . . . . . . . . . . . . . . . . 46 Michael Hunger Don’t Be Afraid to Break Things . . . . . . . . . . . . . . . . . 48 Mike Lewis Don’t Be Cute with Your Test Data . . . . . . . . . . . . . . . . 50 Rod Begbie Don’t Ignore That Error! . . . . . . . . . . . . . . . . . . . . . . . 52 Pete Goodliffe Don’t Just Learn the Language, Understand Its Culture . . 54 Anders Norås Don’t Nail Your Program into the Upright Position . . . . . . 56 Verity Stob Don’t Rely on “Magic Happens Here” . . . . . . . . . . . . . . 58 Alan Griffiths Don’t Repeat Yourself . . . . . . . . . . . . . . . . . . . . . . . . 60 Steve Smith Don’t Touch That Code! . . . . . . . . . . . . . . . . . . . . . . . 62 Cal Evans Contents vii Encapsulate Behavior, Not Just State . . . . . . . . . . . . . . 64 Einar Landre Floating-Point Numbers Aren’t Real . . . . . . . . . . . . . . . 66 Chuck Allison Fulfill Your Ambitions with Open Source . . . . . . . . . . . . 68 Richard Monson-Haefel The Golden Rule of API Design . . . . . . . . . . . . . . . . . . 70 Michael Feathers The Guru Myth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Ryan Brush Hard Work Does Not Pay Off . . . . . . . . . . . . . . . . . . . 74 Olve Maudal How to Use a Bug Tracker . . . . . . . . . . . . . . . . . . . . . 76 Matt Doar Improve Code by Removing It . . . . . . . . . . . . . . . . . . . 78 Pete Goodliffe Install Me . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Marcus Baker Interprocess Communication Affects Application Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Randy Stafford Keep the Build Clean . . . . . . . . . . . . . . . . . . . . . . . . . 84 Johannes Brodwall Know How to Use Command-Line Tools . . . . . . . . . . . . 86 Carroll Robinson viii Contents

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.