This is the fourth post in the reading notes series for The Programmer’s Apprenticeship: From Good to Great. The author, Jeff Atwood, is one of the founders of Stack Overflow. His articles cover a wide range of topics. He is a seasoned programmer, manager, and entrepreneur. This book discusses many things beyond programming. Whether you are a junior engineer or a senior engineer, this book is worth reading. As your experience grows, every time you re-read this book, you will gain new insights. Just as the title “From Good to Great” suggests, the author points out the path for you, but whether you can succeed depends on your own cultivation.
I will excerpt some wonderful remarks from the book and sometimes add my own insights or experiences. The outline of the reading notes is consistent with the outline of the book itself. This is also a method I learned from another source and have been using: “How to Read a Book”. I record it for my own frequent review and for readers’ reference. Below is the The Programmer’s Apprenticeship reading note series:
- The Programmer’s Apprenticeship - 01: The Art of Fighting Back
- The Programmer’s Apprenticeship - 02: The Way of Programming
- The Programmer’s Apprenticeship - 03: Web Design Principles
- The Programmer’s Apprenticeship - 04: Reflections on Testing
- The Programmer’s Apprenticeship - 05: Know Your Users
- The Programmer’s Apprenticeship - 06: All About the Internet
- The Programmer’s Apprenticeship - 07: Games and Programming
- The Programmer’s Apprenticeship - 08: The Beauty of Reading
Unit Testing Is Necessary
The real value of unit testing is that it forces you to stop and think about testing. Most developers don’t test! They just input some numbers at random, click a few buttons, and if no unhandled exceptions are found during this process, they feel the code is good enough to be delivered to the testing team.
Unit testing forces you to think about a series of difficult but unavoidable questions for the code you just wrote:
- How should I test this code?
- What kind of tests should I perform?
- What is the normal situation?
- What are the possible exceptions?
- How many external dependencies do I have?
- What system failures might I encounter?
Sometimes It’s a Hardware Problem
In this section, the author mainly gave an example they actually encountered, a bug caused by hardware. Investigating directly was extremely difficult, but if the right tools were used, it would be twice the result with half the effort.
Although software is unreliable, we can’t always point the finger at software. Sometimes, what you are facing is indeed a hardware problem.
Exception-Driven Development
As a developer, you shouldn’t let users point out errors. You should be more familiar with your system than your users. So you need to establish an exception and error reporting mechanism. You need to focus on handling all errors in one place. This place is something all developers in your team are very familiar with and come into contact with every day. For example, Stack Overflow uses ELMAH.
One thought on “Test-Driven Development” is the return on time investment: If you fix a bug that real users will never encounter, what is the value of your fix?
The author suggests everyone use “Exception-Driven Development”:
- Release your software and let as many users as possible use it.
- Then focus on studying the error logs they generate, use those exception logs to find the root cause of the problem, and focus on the problematic areas in your code.
- Re-architect and refactor the code to eliminate the 3 most serious problems.
- Iterate quickly, deploy, and repeat.
This data-driven feedback mechanism is very effective. After a few iterations, your program will be very stable and solid as a rock.
The Programmer’s Apprenticeship (or Building a Career in Software) is a compilation of the best articles from the Coding Horror blog. The book is divided into 8 chapters, covering topics such as time management, programming methods, web design, testing, user needs, the Internet, game programming, and technical reading. The topics selected by the author are all pain points in a programmer’s career. Many articles have high click-through rates and reply rates on blogs and the Internet. —— from Douban
Jeff Atwood founded the Coding Horror blog (codinghorror.com) in 2004 to record his thoughts and bits and pieces of his software development experience. Today, the blog has nearly 100,000 visits per day. Readers participate in comments, and various views and wisdom collide passionately there. —— from Douban
The writing style of The Programmer’s Apprenticeship is humorous, understanding, and caring; it is suitable for programmers at all stages from novice to veteran, and also suitable for students of computer science and related majors who are about to become programmers. The Programmer’s Apprenticeship can help readers pay more attention to the human nature and humanistic factors of technical work, thereby achieving a successful turning point in their programmer career. —— from Douban
About Me && Blog
Below is my personal introduction and related links. I look forward to exchanging ideas with fellow professionals. “When three walk together, one can always be my teacher!”
- Blogger Intro: Includes personal WeChat and WeChat group links.
- Blog Content Navigation: A guide for my blog content.
- Curated Excellent Blog Articles - Android Performance Optimization Must-Knows: Welcome to recommend projects/articles.
- Android Performance Optimization Knowledge Planet: Welcome to join and thank you for your support~
One person can walk faster, a group can walk further
