将接口视为组织间的契约

1作者: davidvartanian5 个月前
我过去认为接口设计纯粹是一个技术问题。我专注于数据结构、模式验证和最小化延迟。我忽略了人为因素。我最近意识到,即使 API 文档编写得很好,我们的团队也经常互相阻碍。<p>问题不在于代码,而在于缺乏明确的期望。我不再将我们的 API 视为简单的代码定义,而是开始将它们视为坚定的组织条约。<p>当你将接口视为条约时,它会迫使你转变思维模式。你不再优化实现的难易程度,而是开始优化稳定性和可预测性。一个清晰、不可变的接口可以让团队独立运作,因为他们不再需要不断地相互协商。他们只需要信任这份契约。<p>这种转变迫使我们简化了一切。我们删除了那些需要持续跨团队协调的可有可无的功能。我们只专注于条约得以维持所绝对需要的内容。<p>如果再来一次,我会这样做:在编写任何一行实现代码之前,我会花更多时间来协商这些条约。
查看原文
I used to think that interface design was purely a technical concern. I focused on data structures, schema validation, and minimizing latency. I ignored the human factor. I recently realized that our teams were constantly blocked by each other, even when the APIs were well-documented.<p>The issue was not the code. It was the lack of clear expectations. I stopped looking at our APIs as simple code definitions and started treating them as firm organizational treaties.<p>When you treat an interface as a treaty, it forces a shift in mindset. You stop optimizing for ease of implementation and start optimizing for stability and predictability. A clear, immutable interface lets teams operate independently because they no longer need to constantly negotiate with each other. They just trust the contract.<p>This shift forced us to simplify everything. We cut out the nice-to-have features that required constant cross-team coordination. We focused only on what was absolutely required for the treaty to hold.<p>I would do this differently next time. I would spend more time negotiating the treaties before writing a single line of implementation code.