Becoming a Better Programmer

Book description

If you’re passionate about programming and want to get better at it, you’ve come to the right source. Code Craft author Pete Goodliffe presents a collection of useful techniques and approaches to the art and craft of programming that will help boost your career and your well-being.

Goodliffe presents sound advice that he’s learned in 15 years of professional programming. The book’s standalone chapters span the range of a software developer’s life—dealing with code, learning the trade, and improving performance—with no language or industry bias. Whether you’re a seasoned developer, a neophyte professional, or a hobbyist, you’ll find valuable tips in five independent categories:

  • Code-level techniques for crafting lines of code, testing, debugging, and coping with complexity
  • Practices, approaches, and attitudes: keep it simple, collaborate well, reuse, and create malleable code
  • Tactics for learning effectively, behaving ethically, finding challenges, and avoiding stagnation
  • Practical ways to complete things: use the right tools, know what “done” looks like, and seek help from colleagues
  • Habits for working well with others, and pursuing development as a social activity

Publisher resources

View/Submit Errata

Table of contents

  1. Also by Pete Goodliffe
  2. Introduction
    1. What’s Covered?
    2. Who Should Read This?
    3. The Structure
    4. A Note for Mentors
    5. Safari® Books Online
    6. How to Contact Us
    7. Acknowledgments
  3. 1. Care About the Code
  4. I. you.write(code);
  5. 2. Keeping Up Appearances
    1. Presentation Is Powerful
    2. It’s About Communication
    3. Layout
      1. Structure Well
      2. Consistency
    4. Names
      1. Avoid Redundancy
      2. Be Clear
      3. Be Idiomatic
      4. Be Accurate
    5. Making Yourself Presentable
    6. Conclusion
  6. 3. Write Less Code!
    1. Why Should We Care?
    2. Flappy Logic
    3. Duplication
    4. Dead Code
    5. Comments
    6. Verbosity
    7. Bad Design
    8. Whitespace
    9. So What Do We Do?
    10. Conclusion
  7. 4. Improve Code by Removing It
    1. Code Indulgence
    2. It’s Not Bad, It’s Inevitable
    3. So What?
    4. Waking the Dead
    5. Surgical Extraction
    6. Conclusion
  8. 5. The Ghost of a Codebase Past
    1. Presentation
    2. The State of the Art
    3. Idioms
    4. Design Decisions
    5. Bugs
    6. Conclusion
  9. 6. Navigating a Route
    1. A Little Help from My Friends
    2. Look for Clues
    3. Learn by Doing
      1. Low-Hanging Fruit
      2. Inspect the Code
      3. Study, Then Act
      4. Test First
      5. Housekeeping
      6. Document What You Find
    4. Conclusion
  10. 7. Wallowing in Filth
    1. Smell the Signs
    2. Wading into the Cesspit
    3. The Survey Says…
    4. Working in the Sandpit
    5. Cleaning Up Messes
    6. Making Adjustments
    7. Bad Code? Bad Programmers?
  11. 8. Don’t Ignore That Error!
    1. The Mechanism
    2. The Madness
    3. The Mitigation
    4. Conclusion
  12. 9. Expect the Unexpected
    1. Errors
    2. Threading
    3. Shutdown
    4. The Moral of the Story
  13. 10. Bug Hunting
    1. An Economic Concern
    2. An Ounce of Prevention
    3. Bug Hunting
      1. Lay Traps
      2. Learn to Binary Chop
      3. Employ Software Archaeology
      4. Test, Test, Test
      5. Invest in Sharp Tools
      6. Remove Code to Exclude It from Cause Analysis
      7. Cleanliness Prevents Infection
      8. Oblique Strategies
      9. Don’t Rush Away
    4. Non-Reproducible Bugs
    5. Conclusion
  14. 11. Testing Times
    1. Why Test?
      1. Shortening the Feedback Loop
      2. Code That Tests Code
      3. Who Writes the Tests?
    2. Types of Tests
    3. When to Write Tests
    4. When to Run Tests
    5. What to Test
    6. Good Tests
    7. What Does a Test Look Like?
      1. Test Names
    8. The Structure of Tests
      1. Maintain the Tests
      2. Picking a Test Framework
    9. No Code Is an Island
    10. Conclusion
  15. 12. Coping with Complexity
    1. Blobs
    2. Case Study: Reducing Blob Complexity
    3. Lines
    4. And Finally: People
    5. Conclusion
  16. 13. A Tale of Two Systems
    1. The Messy Metropolis
      1. Incomprehensiblity
      2. Lack of Cohesion
      3. Unnecessary Coupling
      4. Code Problems
      5. Problems Outside the Code
      6. A Postcard from the Metropolis
    2. Design Town
      1. Locating Functionality
      2. Consistency
      3. Growing the Architecture
      4. Deferring Design Decisions
      5. Maintaining Quality
      6. Managing Technical Debt
      7. Tests Shape Design
      8. Time for Design
      9. Working with the Design
    3. So What?
  17. II. Practice Makes Perfect
  18. 14. Software Development Is…
    1. This Software (Food)stuff
    2. Software Development Is…an Art
    3. Software Development Is…a Science
    4. Software Development Is…a Sport
    5. Software Development Is…Child’s Play
    6. Software Development Is…a Chore
    7. Metaphor Overload
  19. 15. Playing by the Rules
    1. We Need More Rules!
    2. Set the Rules
  20. 16. Keep It Simple
    1. Simple Designs
      1. Simple to Use
      2. Prevents Misuse
      3. Size Matters
      4. Shorter Code Paths
      5. Stability
    2. Simple Lines of Code
    3. Keeping It Simple, Not Stupid
    4. Assumptions Can Reduce Simplicity
    5. Avoid Premature Optimisation
    6. Sufficiently Simple
    7. A Simple Conclusion
  21. 17. Use Your Brain
    1. Don’t Be Stupid
    2. Avoid Mindlessness
    3. You Are Allowed to Think!
  22. 18. Nothing Is Set in Stone
    1. Fearless Change
    2. Change Your Attitude
    3. Make the Change
      1. Design for Change
      2. Tools for Change
      3. Pick Your Battles
    4. Plus ça Change
  23. 19. A Case for Code Reuse
    1. Reuse Case 1: The Copy-Pasta
    2. Reuse Case 2: Design for Reuse
    3. Reuse Case 3: Promote and Refactor
    4. Reuse Case 4: Buy In, or Reinvent the Wheel
  24. 20. Effective Version Control
    1. Use It or Lose It
    2. Pick One, Any One
    3. Storing the Right Things
      1. Answer One: Store Everything
      2. Answer Two: Store as Little as Possible
      3. Storing Software Releases
      4. Repository Layout
    4. Use Version Control Well
      1. Make Atomic Commits
      2. Sending the Right Messages
      3. Craft Good Commits
    5. Branches: Seeing the Wood for the Trees
    6. The Home for Your Code
    7. Conclusion
  25. 21. Getting One Past the Goalpost
    1. Software Development: Shovelling Manure
    2. A False Dichotomy
    3. Fix the Team to Fix the Code
    4. Releasing a Build to QA
      1. Test Your Work First
      2. Release with Intent
      3. More Haste, Less Speed
      4. Automate
      5. Respect
    5. On Getting a Fault Report
    6. Our Differences Make Us Stronger
    7. Pieces of the Puzzle
  26. 22. The Curious Case of the Frozen Code
    1. Hunting the Code Freeze
    2. A New World Order
    3. Forms of Freeze
    4. Branches Make It Work
    5. But It’s Not Really Frozen!
    6. Length of the Freeze
    7. Feel the Freeze
    8. The End Draws Near
    9. Antifreeze
    10. Conclusion
  27. 23. Please Release Me
    1. Part of the Process
    2. A Cog in the Machine
      1. Step 1: Initiate the Release
      2. Step 2: Prepare the Release
      3. Step 3: Build the Release
      4. Step 4: Package the Release
      5. Step 5: Deploy the Release
    3. Release Early and Often
    4. And There’s More…
  28. III. Getting Personal
  29. 24. Live to Love to Learn
    1. What to Learn?
    2. Learning to Learn
    3. Learning Models
      1. The Knowledge Portfolio
    4. Teach to Learn
    5. Act to Learn
    6. What Have We Learnt?
  30. 25. Test-Driven Developers
    1. Driving the Point Home
    2. Success Breeds Complacency
    3. Testing Times
    4. Test-Driven Developers
    5. Conclusion
  31. 26. Relish the Challenge
    1. It’s the Motivation
    2. What’s the Challenge?
    3. Don’t Do It!
    4. Get Challenged
    5. Conclusion 
  32. 27. Avoid Stagnation
    1. Your Skills Are Your Investment
    2. An Exercise for the Reader
    3. Job Security
  33. 28. The Ethical Programmer
    1. Attitude to Code
    2. Legal Issues
    3. Attitude to People
      1. Teammates
      2. Manager
      3. Employer
      4. Yourself
    4. The Hippocodic Oath
    5. Conclusion
  34. 29. A Love for Languages
    1. Love All Languages
    2. Love Your Language
    3. Cultivating Your Language Relationship
      1. Love and Respect
      2. Commitment
      3. Communication
      4. Patience
      5. Shared Values
    4. A Perfect Metaphor?
    5. Conclusion
  35. 30. Posturing Programmers
    1. Basic Computer Posture
      1. The Debugging Posture
      2. When It’s Really Going Badly
      3. The All-Nighter
      4. Intervention from Above
      5. The All-Clear
      6. Design Time
    2. Eye Strain
    3. Conclusion
  36. IV. Getting Things Done
  37. 31. Smarter, Not Harder
    1. Pick Your Battles
    2. Battle Tactics
      1. Reuse Wisely
      2. Make It Someone Else’s Problem
      3. Only Do What You Have To
      4. Put It on a Spike
      5. Prioritise
      6. What’s Really Required?
      7. One Thing at a Time
      8. Keep It Small (and Simple)
      9. Don’t Defer and Store Up Problems
      10. Automate
      11. Error Prevention
      12. Communicate
      13. Avoid Burnout
      14. Power Tools
    3. Conclusion
  38. 32. It’s Done When It’s Done
    1. Are We There Yet?
    2. Developing Backwards: Decomposition
    3. Define “Done”
    4. Just Do It
  39. 33. This Time I’ve Got It…
    1. Desert Island Development
    2. Stood at the Bottom of the Mountain
  40. V. The People Pursuit
  41. 34. People Power
    1. What to Do
    2. Know Your Experts
    3. 20/20 Hindsight
  42. 35. It’s the Thought That Accounts
    1. Stretching the Metaphor
    2. Accountability Counts
    3. Code++
    4. Making It Work
    5. Setting the Standard
    6. The Next Steps
    7. Conclusion
  43. 36. Speak Up!
    1. Code Is Communication
      1. Talking to the Machines
      2. Talking to the Animals
      3. Talking to Tools
    2. Interpersonal Communication
      1. Ways to Converse
      2. Watch Your Language
      3. Body Language
      4. Parallel Communication
    3. Talking of Teams
    4. Talking to the Customer
    5. Other Communication
    6. Conclusion
  44. 37. Many-festos
    1. A Generic Manifesto for Software Development
    2. OK, OK
    3. The Manyfestos
    4. But, Really?
    5. The Punchline
  45. 38. An Ode to Code
    1. Coding Is a People Problem
  46. Epilogue
    1. Attitude
    2. Go Forth and Code
  47. Index

Product information

  • Title: Becoming a Better Programmer
  • Author(s): Pete Goodliffe
  • Release date: October 2014
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781491905579