Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword or section
Like this
2Activity

Table Of Contents

Toward Good Code
Assume the Worst
What Is Defensive Programming?
The Big, Bad World
Techniques for Defensive Programming
Employ a Good Coding Style and Sound Design
Don’t Code in a Hurry
Trust No One
Write Code for Clarity, Not Brevity
Don’t Let Anyone Tinker with Stuff They Shouldn’t
Compile with All Warnings Switched On
Use Static Analysis Tools
Use Safe Data Structures
Check Every Return Value
Handle Memory (and Other Precious Resources) Carefully
Initialize All Variables at Their Points of Declaration
Declare Variables as Late as Possible
Use Standard Language Facilities
Use a Good Diagnostic Logging Facility
Cast Carefully
The Fine Print
Constraints
What to Constrain
Removing Constraints
In a Nutshell
See Also
Get Thinking
Mull It Over
Getting Personal
The Layout and Presentation of Source Code
What’s the Big Deal?
Know Your Audience
What Is Good Presentation?
Brace Yourself
K&R Brace Style
Exdented Brace Style
Indented Brace Style
Other Brace Styles
One Style to Rule Them All
House Styles (and Where to Stick Them)
Setting the Standard
Righteous Wars?
Why Should We Name Well?
What Do We Name?
Name Games
Descriptive
Technically Correct
Idiomatic
Appropriate
The Nuts and Bolts
Naming Variables
Naming Functions
Naming Types
Naming Namespaces
Naming Macros
Naming Files
A Rose by Any Other Name
Be consistent
Be Consistent
Exploit Context
Use Names to Your Advantage
Self-Documenting Code
Techniques for Self-Documenting Code
Write Simple Code with Good Presentation
Choose Meaningful Names
Decompose into Atomic Functions
Choose Descriptive Types
Name Constants
Emphasize Important Code
Group-Related Information
Provide a File Header
Handle Errors Appropriately
Write Meaningful Comments
Practical Self-Documentation Methodologies
Literate Programming
Documentation Tools
How to Write Code Comments
What Is a Code Comment?
What Do Comments Look Like?
How Many Comments?
What Goes Inside Our Comments?
Explain Why, Not How
Don’t Describe the Code
Don’t Replace Code
Keep It Useful
Avoid Distractions
In Practice
A Comment on Aesthetics
Consistency
Clear Block Comments
Indenting Comments
End-of-Line Comments
Helping You to Read the Code
Choose a Low-Maintenance Style
Breakwaters
Flags
File Header Comments
Working with Comments
Helping You to Write Routines
Bug-Fix Notices
Comment Rot
Maintenance and the Inane Comment
Dealing with the Inevitable— Error Conditions in Code
From Whence It Came
Error-Reporting Mechanisms
No Reporting
Return Values
Error Status Variables
Exceptions
Signals
Detecting Errors
Handling Errors
When to Deal with Errors
Possible Reactions
Code Implications
Raising Hell
Managing Errors
Using Tools to Construct Software
What Is a Software Tool?
Why Worry About Tools?
Power Tools
Understand What It Can Do
Miscellaneous Tools
The Black Art of Testing Code
Reality Check
Who, What, When, and Why?
Why We Test
Who Tests
What Testing Involves
When We Test
Testing Isn’t Hard . .
The Types of Test
Choosing Unit Test Cases
Design for Test
Look! No Hands!
The Face of Failure
Can You Manage It?
Fault-Tracking System
Bug Reviews
The Facts of Life
Nature of the Beast
The View from 1,000 Feet
The View from the Ground
The View from the Trenches
Pest Extermination
The Low Road
The High Road
Bug Hunting
Compile-Time Errors
Run-Time Errors
How to Fix Faults
Prevention
Wasp Spray, Slug Repellent, Fly Paper . .
Debugger
Memory Access Validator
System Call Tracing
Core Dump
Logging
Mechanisms to Turn Source Code into Executable Code
Language Barriers
Interpreted Languages
Compiled Languages
Byte-Compiled Languages
Making Mountains out of Molehills
Building Builds
What Makes a Good Build System?
Simplicity
Uniformity
Repeatable and Reliable
Atomic
Coping with Errors
The Mechanics
Choice of Targets
Housekeeping
Dependencies
Automated Builds
Build Configuration
Recursive Make
Please Release Me
Jack-of-All-Trades, Buildmaster Of?
Optimizing Programs and Writing Efficient Code
What Is Optimization?
What Makes Code Suboptimal?
Why Not Optimize?
Alternatives
Why Optimize?
Prove You Need to Optimize
Identify the Slowest Code
Testing the Code
Optimizing the Code
After Optimization
Optimization Techniques
Design Changes
Code Changes
Writing Efficient Code
Writing Secure Programs
The Risks
The Opposition
Excuses, Excuses
Feeling Vulnerable
Insecure Design and Architecture
Buffer Overrun
Embedded Query Strings
Race Conditions
Integer Overflow
Protection Racket
System Installation Techniques
Software Design Techniques
Code Implementation Techniques
Procedural Techniques
THE SHAPE OF CODE
How to Produce Good Software Designs
Programming as Design
What Do We Design?
What’s All the Fuss About?
Good Software Design
Elegance
Modularity
Good Interfaces
Extensibility
Avoid Duplication
Portability
Well-Documented
How to Design Code
Design Methods and Processes
Design Tools
Laying the Foundations of Software Design
What Is Software Architecture?
Software Blueprints
Points of View
Where and When Do You Do It?
What Is It Used For?
Of Components and Connections
What Is Good Architecture?
Architectural Styles
No Architecture
Layered Architecture
Pipe and Filter Architecture
Client/Server Architecture
Component-Based Architecture
Frameworks
Software Rot
The Warning Signs
How Does Code Grow?
Believe the Impossible
What Can We Do About This?
Writing New Code
Maintenance of Existing Code
Fostering the Correct Attitude and Approach to Programming
Monkey Business
The Eager Coder
The Code Monkey
The Guru
The Demiguru
The Arrogant Genius
The Cowboy
The Planner
The Old Timer
The Zealot
The Monocultured Programmer
The Slacker
The Reluctant Team Leader
The Ideal Programmer
So What?
The Stupidest of Men
Action Sheet
Teamwork and the Individual Programmer
Our Teams—The Big Picture
Team Organization
Management Approach
Division of Responsibility
Organization and Code Structure
Teamwork Tools
Team Diseases
Tower of Babel
Dictatorship
Development Democracy
Satellite Station
The Grand Canyon
Quicksand
Lemmings
Personal Skills and Characteristics for Good Teamwork
Communication
Humility
Dealing with Conflict
Learning and Adaptability
Know Your Limitations
Teamwork Principles
Collective Code Ownership
Respect Other People’s Code
Code Guidelines
Define Success
Define Responsibility
Avoid Burnout
The Team Life Cycle
Team Creation
Team Growth
Teamwork
Team Closure
Source Control and Self-Control
Our Responsibility
Source Control
Revision Control
Access Control
Working with the Repository
Leave Branching to the Trees
A Brief History of Source Control
Configuration Management
Backups
Releasing Source Code
Wherever I Lay My Source
PART OF THE PROCESS
Writing Software Specifications
What Are They, Specifically?
The Types of Specification
Requirements Specification
Functional Specification
System Architecture Specification
Why Don’t We Write Specifications?
What Is a Code Review?
When Do You Review?
Whether to Review
Which Code to Review
Performing Code Reviews
Code Review Meetings
Integration Reviews
Review Your Attitudes
The Author’s Attitude
The Reviewer’s Attitude
Code Perfection
Beyond the Code Review
Checklist
The Black Art of Software Timescale Estimation
A Stab in the Dark
Why Is Estimation So Hard?
Under Pressure
Practical Ways to Estimate
The Planning Game
Keep Up!
Programming Styles
Structured Programming
Object-Oriented Programming
Functional Programming
Logic Programming
Recipes: The How and the What
Development Processes
Ad Hoc
Waterfall Model
SSADM and PRINCE
V Model
Prototyping
Iterative and Incremental Development
Spiral Model
Agile Methodologies
Other Development Processes
Enough, Already!
Pick a Process
The Different Programming Disciplines
Applications Programming
Shrink-Wrap Software
Custom Applications
Games Programming
Systems Programming
Embedded Programming
Distributed Programming
Web Application Programming
Enterprise Programming
Numerical Programming
All’s Well That Ends Well
But What Now?
Chapter 1: On the Defensive
ANSWERS AND DISCUSSION
Chapter 2: The Best Laid Plans
Chapter 4: The Write Stuff
Chapter 5: A Passing Comment
Chapter 6: To Err Is Human
Chapter 7: The Programmer’s Toolbox
Chapter 8: Testing Times
Chapter 9: Finding Fault
Chapter 10: The Code That Jack Built
Chapter 11: The Need for Speed
Chapter 12: An Insecurity Complex
Chapter 15: Software Evolution or Software Revolution?
Chapter 16: Code Monkeys
Chapter 17: Together We Stand
Chapter 18: Practicing Safe Source
Chatper 19: Being Specific
Chapter 20: A Review to a Kill
Chapter 21: How Long Is a Piece of String?
Chapter 22: Recipe for a Program
Chapter 23: The Outer Limits
BIBLIOGRAPHY
INDEX
0 of .
Results for:
No results containing your search query
P. 1
Code Craft - The Practice of Writing Excellent Code (2006)

Code Craft - The Practice of Writing Excellent Code (2006)

Ratings: (0)|Views: 47 |Likes:

More info:

Published by: Ed Phénix le Prince on Aug 08, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

09/24/2013

pdf

text

original

You're Reading a Free Preview
Pages 13 to 153 are not shown in this preview.
You're Reading a Free Preview
Pages 166 to 411 are not shown in this preview.
You're Reading a Free Preview
Pages 424 to 509 are not shown in this preview.
You're Reading a Free Preview
Pages 522 to 555 are not shown in this preview.
You're Reading a Free Preview
Pages 568 to 618 are not shown in this preview.

Activity (2)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->