The Art of readable code: [simple and practical techiques for writing better code]
Gespeichert in:
Hauptverfasser: | , |
---|---|
Format: | Buch |
Sprache: | English |
Veröffentlicht: |
Sebastopol, Calif.
O'Reilly
2012
|
Ausgabe: | 1. Aufl. |
Schlagworte: | |
Online-Zugang: | Inhaltstext Inhaltsverzeichnis |
Beschreibung: | X, 190 S. Ill., graph. Darst. |
ISBN: | 9780596802295 |
Internformat
MARC
LEADER | 00000nam a2200000 c 4500 | ||
---|---|---|---|
001 | BV039718322 | ||
003 | DE-604 | ||
005 | 20120103 | ||
007 | t | ||
008 | 111122s2012 ad|| |||| 00||| eng d | ||
015 | |a 10,N25 |2 dnb | ||
016 | 7 | |a 1003634702 |2 DE-101 | |
020 | |a 9780596802295 |c PB. : EUR 29.00 (freier Pr.) |9 978-0-596-80229-5 | ||
024 | 3 | |a 9780596802295 | |
035 | |a (OCoLC)767788828 | ||
035 | |a (DE-599)DNB1003634702 | ||
040 | |a DE-604 |b ger |e rakddb | ||
041 | 0 | |a eng | |
049 | |a DE-355 |a DE-858 |a DE-M347 |a DE-859 |a DE-898 | ||
084 | |a ST 265 |0 (DE-625)143634: |2 rvk | ||
084 | |a 004 |2 sdnb | ||
100 | 1 | |a Boswell, Dustin |e Verfasser |4 aut | |
245 | 1 | 0 | |a The Art of readable code |b [simple and practical techiques for writing better code] |c Dustin Boswell and Trevor Foucher |
250 | |a 1. Aufl. | ||
264 | 1 | |a Sebastopol, Calif. |b O'Reilly |c 2012 | |
300 | |a X, 190 S. |b Ill., graph. Darst. | ||
336 | |b txt |2 rdacontent | ||
337 | |b n |2 rdamedia | ||
338 | |b nc |2 rdacarrier | ||
650 | 0 | 7 | |a Quellcode |0 (DE-588)4488209-9 |2 gnd |9 rswk-swf |
650 | 0 | 7 | |a Programmierung |0 (DE-588)4076370-5 |2 gnd |9 rswk-swf |
689 | 0 | 0 | |a Programmierung |0 (DE-588)4076370-5 |D s |
689 | 0 | 1 | |a Quellcode |0 (DE-588)4488209-9 |D s |
689 | 0 | |5 DE-604 | |
700 | 1 | |a Foucher, Trevor |e Verfasser |4 aut | |
856 | 4 | 2 | |q text/html |u http://deposit.dnb.de/cgi-bin/dokserv?id=3493909&prov=M&dok_var=1&dok_ext=htm |3 Inhaltstext |
856 | 4 | 2 | |m Digitalisierung UB Regensburg |q application/pdf |u http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=024566478&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA |3 Inhaltsverzeichnis |
943 | 1 | |a oai:aleph.bib-bvb.de:BVB01-024566478 |
Datensatz im Suchindex
_version_ | 1805145590920642560 |
---|---|
adam_text |
CONTENTS
PREFACE vii
1
CODE
SHOULD BE EASY TO UNDERSTAND
1
What Makes Code "Better"?
2
The Fundamental theorem of Readability
3
Is Smaller Always Better?
3
Does Time-Till-Undersiandins Conflict with Other Coals?
Ч
The Hard Part
4
fart On· SURFACE-LEVEL IMPROVEMENTS
2
PACKING INFORMATION INTO NAMES
7
Choose Specific Words
8
Avoid Generic Names Like imp and
refi»/
10
Prefer Concrete Names ouer Abstract Names
13
Attachinj Extra Information to a Name
15
How Long Should a Name Be?
18
Use Name Formatting to Conuey Meaning
20
Summary Zl
3
NAMES THAT CANT BE MISCONSTRUED
23
Example: FiHerO
24
Example: Clipttext.lensth}
24
Prefer
min
and max for (Inclusive) Limits
25
Prefer first and last for Inclusive ftan$es
26
Prefer begin and end for Induslue/Exdusiue
Hanfes 26
Naminf
Booléens
27
Matchini
Expectations of Users
27
Example: Eoaiuatinj Multiple Name Candidates
29
Summary
31
ł
AESTHETICS
33
Why Do Aesthetics MatterT
34
вештапје
Line Breaks to Be Consistent and Compact
35
use Methods to Clean Up Irregularity
37
Ute
Column Alignment When Helpful
38
Pick a Meaningful Order, and Use It Consistently
39
Orfanize Declarations info Stocks
40
Break Code into 'Paratraphs'
41
Personal Styieuenus Consistency
42
Summary
43
5
KNOWING WHAT TO
COMMENT
45
What NOT to
Comment
47
Recording Your Thoughts
49
Put Yourself in the Reader's Shoes
51
Final Thoughts
—
Getting Ooer Writer's Block
56
Summary
57
6
MAKING COMMENTS PRECISE AND COMPACT
59
Keep Comments Compact
60
Avoid Ambiguous Pronouns
60
Polish Sloppy Sentences
61
Describe Function Behavior Precisely
61
Use Input/Output Examples That Illustrate Corner Cases
61
State the Intent of Your Code
62
"Named Function Parameter Comments
63
Use Information-Dense Words
64
Summary
65
Part Two SIMPLIFYING LOOPS AND LOGIC
7
MAKING CONTROL FLOW EASY TO READ
69
The Order of Arguments in Conditionals
70
The Order of if/else Blocks 7X
The
?:
Conditional Expression
fa.łt.a.
"Ternary Operator")
73
Auoid do/while Loops
74
Returning Early from a Function
75
The Infamous goto
76
Minimize Nesting
77
Can
Vou
Follow the Flow of Execution?
79
Summary
80
8
BREAKING DOWN GIANT EXPRESSIONS
83
Explaining Variables
84
Summary Variabies
84
Using
De
Morgan's Laws
85
Abusing Short-Circuit Logic
86
Example: Wrestling with Complicated Logic
86
Breaking Down Giant Statements
89
Another Creative Way to Simplify Expressions
90
Summary
90
9
VARIABLES AND READABILITY
93
Eliminating Variables
94
Shrink the Scope of Vour
Variables 97
Prefer Write-Once Variables
103
A Final Example
104
Summary
106
Nf CONTENTS
Part Three REORGANIZING YOUR CODE
10
EXTRACTING UNRELATED
SUBPROBLEMS 109
Introductory Example: findClosestLocationQ
110
Pure Utility Code 111
Other General-Purpose Code
112
Createa Lot of General-Purpose Code
114
Project-Specific Functionality
115
Simplifying an Existing Interface
116
Reshaping an interface to Your Needs
117
Taking Things Too Far
117
Summary
118
11
ONE TASK AT A TIME
121
Tasks Can Be Small
123
Extracting Values from an Object
124
A Larger Example
128
Summary
130
12
TURNING THOUGHTS INTO CODE
131
Describing Logic Clearly
132
Knowing Your Libraries Helps
133
Applying This Method to Larger Problems
134
Summary
137
13
WRITING LESS CODE
139
Don't Bother Implementing That Feature
—
You Won't Need It
140
Question and Break Down Your Requirements
140
Keeping Your Codebase Small
142
Be Familiar with the Libraries Around You
143
Example: Using Unix Tools Instead of Coding
144
Summary
145
Pari
Four SELECTED TOPICS
_
Ił
TESTING AND READABILITY
149
Make Tests Easy to Head and Maintain
150
What's Wrong with This Test?
150
Making This Test More tteadable
151
Making Error Messages Readable
154
Choosing Good Test Inputs
156
Naming Test Fundions
158
What Was Wrong with That Test?
159
Test-Friendly
Development 160
Going Too Far
162
Summary
162
15
DESIGNING AND IMPLEMENTING
A "MIHUTE/HOUR
COUNTER*
165
The Problem
166
Defining the Class Interface
166
COMTEMTS
Attempt
1:
A Naiue Solution
169
Attempt
2:
Conoeyor Beit Design
171
Attempt
3:
A Time-Bucketed Design
174
Comparing the Three Solutions
179
Summary
179
A FURTHER READING
181
INDEX
185
»I CONTENTS |
any_adam_object | 1 |
author | Boswell, Dustin Foucher, Trevor |
author_facet | Boswell, Dustin Foucher, Trevor |
author_role | aut aut |
author_sort | Boswell, Dustin |
author_variant | d b db t f tf |
building | Verbundindex |
bvnumber | BV039718322 |
classification_rvk | ST 265 |
ctrlnum | (OCoLC)767788828 (DE-599)DNB1003634702 |
discipline | Informatik |
edition | 1. Aufl. |
format | Book |
fullrecord | <?xml version="1.0" encoding="UTF-8"?><collection xmlns="http://www.loc.gov/MARC21/slim"><record><leader>00000nam a2200000 c 4500</leader><controlfield tag="001">BV039718322</controlfield><controlfield tag="003">DE-604</controlfield><controlfield tag="005">20120103</controlfield><controlfield tag="007">t</controlfield><controlfield tag="008">111122s2012 ad|| |||| 00||| eng d</controlfield><datafield tag="015" ind1=" " ind2=" "><subfield code="a">10,N25</subfield><subfield code="2">dnb</subfield></datafield><datafield tag="016" ind1="7" ind2=" "><subfield code="a">1003634702</subfield><subfield code="2">DE-101</subfield></datafield><datafield tag="020" ind1=" " ind2=" "><subfield code="a">9780596802295</subfield><subfield code="c">PB. : EUR 29.00 (freier Pr.)</subfield><subfield code="9">978-0-596-80229-5</subfield></datafield><datafield tag="024" ind1="3" ind2=" "><subfield code="a">9780596802295</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(OCoLC)767788828</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(DE-599)DNB1003634702</subfield></datafield><datafield tag="040" ind1=" " ind2=" "><subfield code="a">DE-604</subfield><subfield code="b">ger</subfield><subfield code="e">rakddb</subfield></datafield><datafield tag="041" ind1="0" ind2=" "><subfield code="a">eng</subfield></datafield><datafield tag="049" ind1=" " ind2=" "><subfield code="a">DE-355</subfield><subfield code="a">DE-858</subfield><subfield code="a">DE-M347</subfield><subfield code="a">DE-859</subfield><subfield code="a">DE-898</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">ST 265</subfield><subfield code="0">(DE-625)143634:</subfield><subfield code="2">rvk</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">004</subfield><subfield code="2">sdnb</subfield></datafield><datafield tag="100" ind1="1" ind2=" "><subfield code="a">Boswell, Dustin</subfield><subfield code="e">Verfasser</subfield><subfield code="4">aut</subfield></datafield><datafield tag="245" ind1="1" ind2="0"><subfield code="a">The Art of readable code</subfield><subfield code="b">[simple and practical techiques for writing better code]</subfield><subfield code="c">Dustin Boswell and Trevor Foucher</subfield></datafield><datafield tag="250" ind1=" " ind2=" "><subfield code="a">1. Aufl.</subfield></datafield><datafield tag="264" ind1=" " ind2="1"><subfield code="a">Sebastopol, Calif.</subfield><subfield code="b">O'Reilly</subfield><subfield code="c">2012</subfield></datafield><datafield tag="300" ind1=" " ind2=" "><subfield code="a">X, 190 S.</subfield><subfield code="b">Ill., graph. Darst.</subfield></datafield><datafield tag="336" ind1=" " ind2=" "><subfield code="b">txt</subfield><subfield code="2">rdacontent</subfield></datafield><datafield tag="337" ind1=" " ind2=" "><subfield code="b">n</subfield><subfield code="2">rdamedia</subfield></datafield><datafield tag="338" ind1=" " ind2=" "><subfield code="b">nc</subfield><subfield code="2">rdacarrier</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">Quellcode</subfield><subfield code="0">(DE-588)4488209-9</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">Programmierung</subfield><subfield code="0">(DE-588)4076370-5</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="689" ind1="0" ind2="0"><subfield code="a">Programmierung</subfield><subfield code="0">(DE-588)4076370-5</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2="1"><subfield code="a">Quellcode</subfield><subfield code="0">(DE-588)4488209-9</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2=" "><subfield code="5">DE-604</subfield></datafield><datafield tag="700" ind1="1" ind2=" "><subfield code="a">Foucher, Trevor</subfield><subfield code="e">Verfasser</subfield><subfield code="4">aut</subfield></datafield><datafield tag="856" ind1="4" ind2="2"><subfield code="q">text/html</subfield><subfield code="u">http://deposit.dnb.de/cgi-bin/dokserv?id=3493909&prov=M&dok_var=1&dok_ext=htm</subfield><subfield code="3">Inhaltstext</subfield></datafield><datafield tag="856" ind1="4" ind2="2"><subfield code="m">Digitalisierung UB Regensburg</subfield><subfield code="q">application/pdf</subfield><subfield code="u">http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=024566478&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA</subfield><subfield code="3">Inhaltsverzeichnis</subfield></datafield><datafield tag="943" ind1="1" ind2=" "><subfield code="a">oai:aleph.bib-bvb.de:BVB01-024566478</subfield></datafield></record></collection> |
id | DE-604.BV039718322 |
illustrated | Illustrated |
indexdate | 2024-07-21T00:16:27Z |
institution | BVB |
isbn | 9780596802295 |
language | English |
oai_aleph_id | oai:aleph.bib-bvb.de:BVB01-024566478 |
oclc_num | 767788828 |
open_access_boolean | |
owner | DE-355 DE-BY-UBR DE-858 DE-M347 DE-859 DE-898 DE-BY-UBR |
owner_facet | DE-355 DE-BY-UBR DE-858 DE-M347 DE-859 DE-898 DE-BY-UBR |
physical | X, 190 S. Ill., graph. Darst. |
publishDate | 2012 |
publishDateSearch | 2012 |
publishDateSort | 2012 |
publisher | O'Reilly |
record_format | marc |
spelling | Boswell, Dustin Verfasser aut The Art of readable code [simple and practical techiques for writing better code] Dustin Boswell and Trevor Foucher 1. Aufl. Sebastopol, Calif. O'Reilly 2012 X, 190 S. Ill., graph. Darst. txt rdacontent n rdamedia nc rdacarrier Quellcode (DE-588)4488209-9 gnd rswk-swf Programmierung (DE-588)4076370-5 gnd rswk-swf Programmierung (DE-588)4076370-5 s Quellcode (DE-588)4488209-9 s DE-604 Foucher, Trevor Verfasser aut text/html http://deposit.dnb.de/cgi-bin/dokserv?id=3493909&prov=M&dok_var=1&dok_ext=htm Inhaltstext Digitalisierung UB Regensburg application/pdf http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=024566478&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA Inhaltsverzeichnis |
spellingShingle | Boswell, Dustin Foucher, Trevor The Art of readable code [simple and practical techiques for writing better code] Quellcode (DE-588)4488209-9 gnd Programmierung (DE-588)4076370-5 gnd |
subject_GND | (DE-588)4488209-9 (DE-588)4076370-5 |
title | The Art of readable code [simple and practical techiques for writing better code] |
title_auth | The Art of readable code [simple and practical techiques for writing better code] |
title_exact_search | The Art of readable code [simple and practical techiques for writing better code] |
title_full | The Art of readable code [simple and practical techiques for writing better code] Dustin Boswell and Trevor Foucher |
title_fullStr | The Art of readable code [simple and practical techiques for writing better code] Dustin Boswell and Trevor Foucher |
title_full_unstemmed | The Art of readable code [simple and practical techiques for writing better code] Dustin Boswell and Trevor Foucher |
title_short | The Art of readable code |
title_sort | the art of readable code simple and practical techiques for writing better code |
title_sub | [simple and practical techiques for writing better code] |
topic | Quellcode (DE-588)4488209-9 gnd Programmierung (DE-588)4076370-5 gnd |
topic_facet | Quellcode Programmierung |
url | http://deposit.dnb.de/cgi-bin/dokserv?id=3493909&prov=M&dok_var=1&dok_ext=htm http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=024566478&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA |
work_keys_str_mv | AT boswelldustin theartofreadablecodesimpleandpracticaltechiquesforwritingbettercode AT fouchertrevor theartofreadablecodesimpleandpracticaltechiquesforwritingbettercode |