pragmatic-programmer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

The Pragmatic Programmer Reference

《程序员修炼之道》参考手册

A comprehensive reference for pragmatic software development principles based on "The Pragmatic Programmer" by David Thomas and Andrew Hunt. This skill provides timeless advice for becoming a better developer.
这是基于David Thomas和Andrew Hunt所著《程序员修炼之道》的务实软件开发原则综合参考手册。本技能为成为更优秀的开发者提供永不过时的建议。

When This Skill Activates

本技能的激活场景

This skill automatically activates when you:
  • Discuss software development best practices
  • Need debugging strategies
  • Consider code duplication (DRY)
  • Think about tooling and automation
  • Discuss project estimation or planning
  • Review development workflows
当你进行以下操作时,本技能会自动激活:
  • 讨论软件开发最佳实践
  • 需要调试策略
  • 考虑代码重复(DRY)问题
  • 思考工具与自动化相关内容
  • 讨论项目估算或规划
  • 评审开发工作流

Core Philosophy

核心理念

"Care about your craft." "Think about your work."
Pragmatic programmers:
  • Take responsibility for their career and work
  • Don't make excuses—provide options
  • Are agents of change, not victims of circumstance
  • Continuously learn and adapt
"重视你的技艺。" "思考你的工作。"
务实的程序员:
  • 为自己的职业和工作负责
  • 不找借口,而是提供解决方案
  • 是变革的推动者,而非环境的受害者
  • 持续学习与适应

Quick Reference

快速参考

Foundational Principles

基础原则

PrincipleSummary
DRY - Don't Repeat YourselfEvery piece of knowledge has a single representation
OrthogonalityKeep things independent and decoupled
ReversibilityMake decisions reversible; avoid lock-in
Tracer BulletsGet feedback fast with end-to-end skeleton
PrototypesLearn before committing; throw away prototypes
Domain LanguagesProgram close to the problem domain
EstimatingLearn to give accurate estimates
原则摘要
DRY - Don't Repeat Yourself每一项知识都有唯一的表示形式
Orthogonality保持事物独立且解耦
Reversibility让决策具备可逆性;避免锁定
Tracer Bullets通过端到端骨架快速获取反馈
Prototypes先学习再投入;原型可丢弃
Domain Languages贴近问题域进行编程
Estimating学会给出准确的估算

Practical Techniques

实用技巧

PracticeSummary
The Power of Plain TextKeep knowledge in accessible format
Shell GamesMaster the command line
DebuggingFix the problem, not the blame
Text ManipulationLearn text processing tools
Code GeneratorsWrite code that writes code
Design by ContractDefine rights and responsibilities
Assertive ProgrammingIf it can't happen, use assertions
DecouplingMinimize dependencies between modules
RefactoringImprove code continuously
TestingTest early, test often, test automatically
AutomationDon't use manual procedures
实践摘要
The Power of Plain Text以易访问的格式存储知识
Shell Games精通命令行
Debugging解决问题,而非归咎于人
Text Manipulation学习文本处理工具
Code Generators编写能生成代码的代码
Design by Contract定义权利与责任
Assertive Programming对于不可能发生的情况,使用断言
Decoupling最小化模块间的依赖
Refactoring持续改进代码
Testing尽早测试、经常测试、自动化测试
Automation拒绝手动流程

The Pragmatic Tips

务实小贴士

Key tips from the book:
  1. Care About Your Craft - Why spend your life developing software unless you care?
  2. Think! About Your Work - Turn off autopilot and take control
  3. Provide Options, Don't Make Excuses - Don't say it can't be done; explain what can be done
  4. Don't Live with Broken Windows - Fix bad designs and wrong decisions when you see them
  5. Be a Catalyst for Change - Show people the future and help them participate
  6. Remember the Big Picture - Don't get so focused you forget what you're doing
  7. Make Quality a Requirements Issue - Get users involved in determining quality
  8. Invest Regularly in Your Knowledge Portfolio - Make learning a habit
  9. Critically Analyze What You Read and Hear - Don't be swayed by vendors or media hype
  10. It's Both What You Say and How You Say It - Communication matters
书中的关键小贴士:
  1. 重视你的技艺 - 除非你热爱这份工作,否则为何要一生投入软件开发?
  2. 思考你的工作 - 关闭自动驾驶模式,掌控自己的工作
  3. 提供解决方案,而非找借口 - 不说“做不到”,而是说明“能做什么”
  4. 不要容忍破窗 - 一旦发现不良设计或错误决策,立即修复
  5. 成为变革的催化剂 - 向人们展示未来,并帮助他们参与其中
  6. 牢记全局 - 不要过于专注细节而忘记初衷
  7. 将质量作为需求问题 - 让用户参与质量标准的制定
  8. 定期投资你的知识组合 - 让学习成为习惯
  9. 批判性地分析你阅读和听到的内容 - 不要被厂商或媒体炒作左右
  10. 内容与表达方式同样重要 - 沟通至关重要

The Knowledge Portfolio

知识投资组合

Treat your knowledge like a financial portfolio:
  • Invest regularly - Learn something new routinely
  • Diversify - Know many different technologies
  • Manage risk - Balance safe tech with high-risk/high-reward
  • Buy low, sell high - Learn emerging tech before it becomes mainstream
  • Review and rebalance - Reassess periodically
将你的知识视为金融投资组合:
  • 定期投资 - 定期学习新知识
  • 多元化 - 了解多种不同技术
  • 管理风险 - 在安全技术与高风险高回报技术间取得平衡
  • 低买高卖 - 在新兴技术成为主流前学习它
  • 复盘与再平衡 - 定期重新评估

Suggestions:

建议:

  • Learn a new language every year
  • Read a technical book each month
  • Read non-technical books too
  • Take classes
  • Participate in local user groups
  • Experiment with different environments
  • Stay current (newsletters, blogs, conferences)
  • 每年学习一门新语言
  • 每月阅读一本技术书籍
  • 也阅读非技术书籍
  • 参加课程
  • 参与本地用户组活动
  • 尝试不同的开发环境
  • 紧跟技术前沿(通讯简报、博客、会议)

Communication

沟通

  • Know what you want to say
  • Know your audience
  • Choose the right moment
  • Choose a style
  • Make it look good
  • Involve your audience
  • Be a listener
  • Get back to people
  • Documentation is part of the project, not after
  • 明确你要表达的内容
  • 了解你的受众
  • 选择合适的时机
  • 选择恰当的风格
  • 让内容清晰美观
  • 引导受众参与
  • 学会倾听
  • 及时回复他人
  • 文档是项目的一部分,而非事后补充

Language Translation Notes

语言适配说明

Examples use generic pseudocode. Adapt to your language:
  • PHP:
    class
    ,
    function
    ,
    ->
    , type hints
  • JavaScript/TypeScript:
    class
    , arrow functions,
    .
  • Python:
    class
    ,
    def
    ,
    .
    , type hints
  • Java/C#: Direct mapping with access modifiers

Based on concepts from "The Pragmatic Programmer: Your Journey to Mastery" by David Thomas and Andrew Hunt.
示例使用通用伪代码。可适配你使用的语言:
  • PHP
    class
    ,
    function
    ,
    ->
    , 类型提示
  • JavaScript/TypeScript
    class
    , 箭头函数,
    .
  • Python
    class
    ,
    def
    ,
    .
    , 类型提示
  • Java/C#:直接映射并使用访问修饰符

基于David Thomas和Andrew Hunt所著《程序员修炼之道:通向大师之路》中的概念。