Beautiful Code: Leading Programmers Explain How They Think.pdf (O’Reilly Related) | Tải miễn phí

Beautiful Code: Leading Programmers Explain How They Think

pdf

Số trang Beautiful Code: Leading Programmers Explain How They Think
619
Cỡ tệp Beautiful Code: Leading Programmers Explain How They Think
5 MB
Lượt tải Beautiful Code: Leading Programmers Explain How They Think
0
Lượt đọc Beautiful Code: Leading Programmers Explain How They Think
1
Đánh giá Beautiful Code: Leading Programmers Explain How They Think

4.7 (
19 lượt)

6195 MB

Nhấn vào bên dưới để tải tài liệu

Đang xem trước 10 trên tổng 619 trang, để tải xuống xem không thiếu hãy nhấn vào bên trên

Chủ đề tương quan

Tài liệu tương tự

Nội dung

www.it-ebooks.info

Beautiful Code

www.it-ebooks.info

Other resources from O’Reilly
Related titles

oreilly.com

Applied Software Project
Management
The Art of Project
Management
Database in Depth
Essential Business Process
Modeling
Head First Design Patterns

Head First Object-Oriented
Analysis & Design
Mastering Regular
Expressions
The Myths of Innovation
Prefactoring
Process Improvement
Essentials

oreilly.com is more than a complete catalog of O’Reilly
books. You’ll also find links to news, events, articles,
weblogs, sample chapters, and code examples.
oreillynet.com is the essential portal for developers interested
in open and emerging technologies, including new platforms, programming languages, and operating systems.

Conferences

O’Reilly brings diverse innovators together to nurture the
ideas that spark revolutionary industries. We specialize in
documenting the latest tools and systems, translating the
innovator’s knowledge into useful skills for those in the
trenches. Visit conferences.oreilly.com for our upcoming
events.
Safari Bookshelf (safari.oreilly.com) is the premier online
reference library for programmers and IT professionals.
Conduct searches across more than 1,000 books. Subscribers can zero in on answers to time-critical questions
in a matter of seconds. Read the books on your Bookshelf
from cover to cover or simply flip to the page you need.
Try it today for free.

www.it-ebooks.info

Beautiful Code

Edited by Andy Oram and Greg Wilson

Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo

www.it-ebooks.info

Beautiful Code
Edited by Andy Oram and Greg Wilson
Copyright © 2007 O’Reilly Media, Inc. 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 (safari.oreilly.com). For more information, contact our
corporate/institutional sales department: (800) 998-9938 or [email protected]

Production Editor: Marlowe Shaeffer

Cover Designer: Randy Comer

Copyeditor: Sanders Kleinfeld

Interior Designer: Marcia Friedman

Proofreader: Sohaila Abdulali

Illustrator: Jessamyn Read

Indexer: Ellen Troutman Zaig
Printing History:
June 2007:

First Edition.

The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Beautiful Code 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 claimed 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 authors
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.
ISBN-10: 0-596-51004-7
ISBN-13: 978-0-596-51004-6
[C]

[8/07]

www.it-ebooks.info

All royalties from this book will be donated to Amnesty International.

www.it-ebooks.info

www.it-ebooks.info

CONTENTS

FOREWORD
by Greg Wilson
PREFACE
1

2

3

4

CHAPTER 0

xv
xvii

A REGULAR EXPRESSION MATCHER
by Brian Kernighan

1

The Practice of Programming
Implementation
Discussion
Alternatives
Building on It
Conclusion

2
3
4
5
6
8

SUBVERSION’S DELTA EDITOR: INTERFACE AS ONTOLOGY
by Karl Fogel

11

Version Control and Tree Transformation
Expressing Tree Differences
The Delta Editor Interface
But Is It Art?
Abstraction As a Spectator Sport
Conclusions

12
16
17
23
25
27

THE MOST BEAUTIFUL CODE I NEVER WROTE
by Jon Bentley

29

The Most Beautiful Code I Ever Wrote
More and More with Less and Less
Perspective
What Is Writing?
Conclusion
Acknowledgments

30
31
36
38
39
40

FINDING THINGS
by Tim Bray

41

On Time
Problem: Weblog Data
Problem: Who Fetched What, When?
Search in the Large
Conclusion

41
42
50
55
57

vii

www.it-ebooks.info

5

6

7

CORRECT, BEAUTIFUL, FAST (IN THAT ORDER): LESSONS
FROM DESIGNING XML VERIFIERS
by Elliotte Rusty Harold

59

The Role of XML Validation
The Problem
Version 1: The Naïve Implementation
Version 2: Imitating the BNF Grammar O(N)
Version 3: First Optimization O(log N)
Version 4: Second Optimization: Don’t Check Twice
Version 5: Third Optimization O(1)
Version 6: Fourth Optimization: Caching
The Moral of the Story

59
60
62
63
64
66
68
72
74

FRAMEWORK FOR INTEGRATED TEST: BEAUTY THROUGH FRAGILITY
by Michael Feathers

75

An Acceptance Testing Framework in Three Classes
The Challenge of Framework Design
An Open Framework
How Simple Can an HTML Parser Be?
Conclusion

76
78
79
80
83

BEAUTIFUL TESTS
by Alberto Savoia

85

That Pesky Binary Search
Introducing JUnit
Nailing Binary Search
Conclusion

87
89
90
102

8

ON-THE-FLY CODE GENERATION FOR IMAGE PROCESSING
by Charles Petzold

105

9

TOP DOWN OPERATOR PRECEDENCE
by Douglas Crockford

129

JavaScript
Symbol Table
Tokens
Precedence
Expressions
Infix Operators
Prefix Operators
Assignment Operators
Constants
Scope
Statements

130
131
132
133
134
134
136
137
138
138
140

viii C O N T E N T S

www.it-ebooks.info

10

11

12

13

Functions
Array and Object Literals
Things to Do and Think About

143
144
145

THE QUEST FOR AN ACCELERATED POPULATION COUNT
by Henry S. Warren, Jr.

147

Basic Methods
Divide and Conquer
Other Methods
Sum and Difference of Population Counts of Two Words
Comparing the Population Counts of Two Words
Counting the 1-Bits in an Array
Applications

148
149
151
152
153
154
158

SECURE COMMUNICATION: THE TECHNOLOGY OF FREEDOM
by Ashish Gulhati

161

The Heart of the Start
Untangling the Complexity of Secure Messaging
Usability Is the Key
The Foundation
The Test Suite
The Functioning Prototype
Clean Up, Plug In, Rock On…
Hacking in the Himalayas
The Invisible Hand Moves
Speed Does Matter
Communications Privacy for Individual Rights
Hacking the Civilization

162
163
165
167
172
172
173
177
182
184
185
185

GROWING BEAUTIFUL CODE IN BIOPERL
by Lincoln Stein

187

BioPerl and the Bio::Graphics Module
The Bio::Graphics Design Process
Extending Bio::Graphics
Conclusions and Lessons Learned

188
192
210
214

THE DESIGN OF THE GENE SORTER
by Jim Kent

217

The User Interface of the Gene Sorter
Maintaining a Dialog with the User over the Web
A Little Polymorphism Can Go a Long Way
Filtering Down to Just the Relevant Genes
Theory of Beautiful Code in the Large
Conclusion

218
219
221
224
225
228

C O N T E N T S ix

www.it-ebooks.info

Source: https://leading10.vn
Category : blog Leading